700
|
How can I filter the check-boxes (method 1)
![](images/exgridq700.png)
with thisform.Grid1
with .Columns.Add("Check")
with .Editor
.EditType = 19
.Option(17) = 1
endwith
.DisplayFilterButton = .T.
.DisplayFilterPattern = .F.
.FilterType = 6
endwith
with .Items
.AddItem(.T.)
.AddItem(.T.)
.AddItem(.F.)
.AddItem(.T.)
.AddItem(.F.)
.AddItem(.T.)
.AddItem(.F.)
endwith
endwith
|
699
|
How can add a button to control
![](images/exgridq699.png)
*** ButtonClick event - Occurs when user clicks on the cell's button. ***
LPARAMETERS Item,ColIndex,Key
with thisform.Grid1
DEBUGOUT( "ButtonClick" )
DEBUGOUT( .Items.CellCaption(Item,ColIndex) )
DEBUGOUT( Key )
endwith
with thisform.Grid1
.BeginUpdate
.DefaultItemHeight = 22
.HeaderHeight = 22
.Appearance = 0
.DrawGridLines = -2
.ScrollBySingleLine = .F.
var_s = "gBJJgBAIDAAGAAEAAQhYAf8Pf4hh0QihCJo2AEZjQAjEZFEaIEaEEaAIAkcbk0olUrlktl0vmExmUzmk1m03nE5nU7nk9n0/oFBoVDolFo1HpFJpVLplNp1PqFRqVTql"
var_s = var_s + "Vq1XrFZrVbrldr1fsFhsVjslls1ntFptVrtltt1vuFxuVzul1u13vF5vV7vl9v1/wGBwWDwmFw2HxGJxWLxmNx0xiFdyOTh8Tf9ZymXx+QytcyNgz8r0OblWjyWds+m0"
var_s = var_s + "ka1Vf1ta1+r1mos2xrG2xeZ0+a0W0qOx3GO4NV3WeyvD2XJ5XL5nN51aiw+lfSj0gkUkAEllHanHI5j/cHg8EZf7w8vl8j4f/qfEZeB09/vjLAB30+kZQAP/P5/H6/yN"
var_s = var_s + "AOAEAwCjMBwFAEDwJBMDwLBYAP2/8Hv8/gAGAD8LQs9w/nhDY/oygIA="
.Images(var_s)
.Object.HTMLPicture("pic1") = "c:\exontrol\images\auction.gif"
with .Columns
with .Add("Type")
.Width = 48
.Def(17) = 1
endwith
with .Add("Appearance")
.Def(17) = 1
.Alignment = 1
.HeaderAlignment = 1
endwith
endwith
with .Items
h = .AddItem("Items.<b>CellHasButton</b> property")
.DefaultItem = h
.CellValue(0,1) = "Button <b>1</b>"
.DefaultItem = h
.CellHasButton(0,1) = .T.
h = .AddItem("Items.<b>CellButtonAutoWidth</b> property")
.DefaultItem = h
.CellValue(0,1) = " Button <b>2</b> "
.DefaultItem = h
.CellHasButton(0,1) = .T.
.DefaultItem = h
.CellButtonAutoWidth(0,1) = .T.
h = .AddItem("Items.<b>CellHasButton</b> property")
.DefaultItem = h
.CellValue(0,1) = " <img>2</img>Button <b>3</b> "
.DefaultItem = h
.CellHasButton(0,1) = .T.
.DefaultItem = h
.CellButtonAutoWidth(0,1) = .T.
h = .AddItem("Items.<b>CellHasButton</b> property")
.DefaultItem = h
.ItemHeight(0) = 32
.DefaultItem = h
.CellValue(0,1) = " <img>2</img>Button <b>4</b> <img>pic1</img> "
.DefaultItem = h
.CellHasButton(0,1) = .T.
.DefaultItem = h
.CellButtonAutoWidth(0,1) = .T.
h = .AddItem("Items.<b>CellHasButton</b> in splitted cells")
.DefaultItem = h
.CellValue(0,1) = " Button <b>5.1</b> "
.DefaultItem = h
.CellHasButton(0,1) = .T.
.DefaultItem = h
.CellButtonAutoWidth(0,1) = .T.
s = .SplitCell(h,1)
.CellValue(0,s) = " Button <b>5.2</b> "
.CellHasButton(0,s) = .T.
.CellButtonAutoWidth(0,s) = .T.
h = .AddItem("Column.<b>Editor</b>, Items.<b>CellEditor</b>")
.DefaultItem = h
.CellValue(0,1) = "Visible when clicking the cell"
with .CellEditor(h,1)
.EditType = 1
.AddButton("B1",1,0,"This is a bit of text that's shown when the cursor hovers the button B1")
.AddButton("B3",2,1,"This is a bit of text that's shown when the cursor hovers the button B3")
.AddButton("B4",1,1,"This is a bit of text that's shown when the cursor hovers the button B4")
.ButtonWidth = 24
endwith
h = .AddItem("Column.<b>Editor</b>, Items.<b>CellEditor</b>")
.DefaultItem = h
.CellValue(0,1) = 3
with .CellEditor(h,1)
.EditType = 6
.AddItem(1,"Flag 1")
.AddItem(2,"Flag 2")
.AddItem(4,"Flag 4")
.AddItem(8,"Flag 8")
.AddButton("C1",1,0,"This is a bit of text that's shown when the cursor hovers the button C1")
.AddButton("C3",2,0,"This is a bit of text that's shown when the cursor hovers the button C2")
.AddButton("C4",1,0,"This is a bit of text that's shown when the cursor hovers the button C3")
.ButtonWidth = 24
endwith
endwith
.EndUpdate
endwith
|
698
|
The item is not getting selected when clicking the cell's checkbox. What should I do
![](images/exgridq698.png)
*** CellStateChanged event - Fired after cell's state has been changed. ***
LPARAMETERS Item,ColIndex
with thisform.Grid1
.DefaultItem = Item
.Items.SelectItem(0) = .T.
endwith
with thisform.Grid1
.Columns.Add("Check").Def(0) = .T.
with .Items
.AddItem(0)
.AddItem(1)
.AddItem(2)
.AddItem(3)
endwith
endwith
|
697
|
Is it possible to limit the height of the item while resizing
![](images/exgridq697.png)
*** AddItem event - Occurs after a new Item has been inserted to Items collection. ***
LPARAMETERS Item
with thisform.Grid1
.DefaultItem = Item
.Items.ItemMinHeight(0) = 18
.DefaultItem = Item
.Items.ItemMaxHeight(0) = 72
endwith
with thisform.Grid1
.BeginUpdate
.ItemsAllowSizing = -1
.ScrollBySingleLine = .F.
.BackColorAlternate = RGB(240,240,240)
.Columns.Add("Names")
with .Items
.AddItem("Mantel")
.AddItem("Mechanik")
.AddItem("Motor")
.AddItem("Murks")
.AddItem("Märchen")
.AddItem("Möhren")
.AddItem("Mühle")
endwith
.Columns.Item(0).SortOrder = 1
.EndUpdate
endwith
|
696
|
Is it possible to copy the hierarchy of the control using the GetItems method
![](images/exgridq696.png)
with thisform.Grid1
.LinesAtRoot = -1
.Columns.Add("Def")
with .Items
h = .AddItem("Root")
.InsertItem(h,Null,"Child 1")
.InsertItem(h,Null,"Child 2")
endwith
.PutItems(.GetItems(-1))
endwith
|
695
|
Is it possible to auto-numbering the children items but still keeps the position after filtering
![](images/exgridq695.png)
with thisform.Grid1
.BeginUpdate
.LinesAtRoot = -1
with .Columns.Add("Items")
.DisplayFilterButton = .T.
.FilterType = 240
.Filter = "Child 2"
endwith
with .Columns.Add("Pos.1")
.FormatColumn = "1 ropos ''"
.Position = 0
.Width = 32
.AllowSizing = .F.
endwith
with .Columns.Add("Pos.2")
.FormatColumn = "1 ropos ':'"
.Position = 1
.Width = 32
.AllowSizing = .F.
endwith
with .Columns.Add("Pos.3")
.FormatColumn = "1 ropos ':|A-Z'"
.Position = 2
.Width = 32
.AllowSizing = .F.
endwith
with .Columns.Add("Pos.4")
.FormatColumn = "1 ropos '|A-Z|'"
.Position = 3
.Width = 32
.AllowSizing = .F.
endwith
with .Columns.Add("Pos.5")
.FormatColumn = "'<font Tahoma;7>' + 1 ropos '-<b>||A-Z'"
.Def(17) = 1
.Position = 4
.Width = 32
.AllowSizing = .F.
endwith
with .Columns.Add("Pos.6")
.FormatColumn = "'<b>'+ 1 ropos '</b>:<fgcolor=FF0000>|A-Z|'"
.Def(17) = 1
.Position = 5
.Width = 48
.AllowSizing = .F.
endwith
with .Items
h = .AddItem("Root 1")
.InsertItem(h,Null,"Child 1")
.InsertItem(h,Null,"Child 2")
.DefaultItem = h
.ExpandItem(0) = .T.
h = .AddItem("Root 2")
.InsertItem(h,Null,"Child 1")
.InsertItem(h,Null,"Child 2")
endwith
.ApplyFilter
.EndUpdate
endwith
|
694
|
Is it possible to auto-numbering the children items too
![](images/exgridq694.png)
with thisform.Grid1
.BeginUpdate
.LinesAtRoot = -1
.Columns.Add("Items")
with .Columns.Add("Pos.1")
.FormatColumn = "1 rpos ''"
.Position = 0
.Width = 32
.AllowSizing = .F.
endwith
with .Columns.Add("Pos.2")
.FormatColumn = "1 rpos ':'"
.Position = 1
.Width = 32
.AllowSizing = .F.
endwith
with .Columns.Add("Pos.3")
.FormatColumn = "1 rpos ':|A-Z'"
.Position = 2
.Width = 32
.AllowSizing = .F.
endwith
with .Columns.Add("Pos.4")
.FormatColumn = "1 rpos '|A-Z|'"
.Position = 3
.Width = 32
.AllowSizing = .F.
endwith
with .Columns.Add("Pos.5")
.FormatColumn = "'<font Tahoma;7>' + 1 rpos '-<b>||A-Z'"
.Def(17) = 1
.Position = 4
.Width = 32
.AllowSizing = .F.
endwith
with .Columns.Add("Pos.6")
.FormatColumn = "'<b>'+ 1 rpos '</b>:<fgcolor=FF0000>|A-Z|'"
.Def(17) = 1
.Position = 5
.Width = 48
.AllowSizing = .F.
endwith
with .Items
h = .AddItem("Root 1")
.InsertItem(h,Null,"Child 1")
.InsertItem(h,Null,"Child 2")
.DefaultItem = h
.ExpandItem(0) = .T.
h = .AddItem("Root 2")
.InsertItem(h,Null,"Child 1")
.InsertItem(h,Null,"Child 2")
endwith
.EndUpdate
endwith
|
693
|
Is it possible to cancel or discard the values during validation
![](images/exgridq693.png)
*** ValidateValue event - Occurs before user changes the cell's value. ***
LPARAMETERS Item,ColIndex,NewValue,Cancel
with thisform.Grid1
DEBUGOUT( "ValidateValue" )
DEBUGOUT( NewValue )
DEBUGOUT( "Change the Cancel parameter for ValidateValue event to accept/decline the newly value. " )
DEBUGOUT( "The DiscardValidateValue restores back the previously values." )
.DiscardValidateValue
endwith
with thisform.Grid1
.BeginUpdate
.CauseValidateValue = -1
.Columns.Add("Date").Editor.EditType = 7
.Columns.Add("Text").Editor.EditType = 1
with .Items
.DefaultItem = .AddItem({^2001-1-1})
.CellValue(0,1) = "text"
.DefaultItem = .AddItem({^2001-1-1})
.CellValue(0,1) = "text"
.DefaultItem = .AddItem({^2001-1-1})
.CellValue(0,1) = "text"
.DefaultItem = .AddItem({^2001-1-1})
.CellValue(0,1) = "text"
.DefaultItem = .AddItem({^2001-1-1})
.CellValue(0,1) = "text"
endwith
.EndUpdate
endwith
|
692
|
Is it possible to validate the values of the cells only when user leaves the focused item
*** ValidateValue event - Occurs before user changes the cell's value. ***
LPARAMETERS Item,ColIndex,NewValue,Cancel
with thisform.Grid1
DEBUGOUT( "ValidateValue" )
DEBUGOUT( NewValue )
DEBUGOUT( "Change the Cancel parameter for ValidateValue event to accept/decline the newly value. " )
Cancel = .T.
DEBUGOUT( "You can not leave the item/record until the Cancel is False." )
endwith
with thisform.Grid1
.BeginUpdate
.CauseValidateValue = 1
.Columns.Add("Date").Editor.EditType = 7
.Columns.Add("Text").Editor.EditType = 1
with .Items
.DefaultItem = .AddItem({^2001-1-1})
.CellValue(0,1) = "text"
.DefaultItem = .AddItem({^2001-1-1})
.CellValue(0,1) = "text"
.DefaultItem = .AddItem({^2001-1-1})
.CellValue(0,1) = "text"
.DefaultItem = .AddItem({^2001-1-1})
.CellValue(0,1) = "text"
.DefaultItem = .AddItem({^2001-1-1})
.CellValue(0,1) = "text"
endwith
.EndUpdate
endwith
|
691
|
We would like to validate the values of the cells. Is it possible
![](images/exgridq691.png)
*** ValidateValue event - Occurs before user changes the cell's value. ***
LPARAMETERS Item,ColIndex,NewValue,Cancel
with thisform.Grid1
DEBUGOUT( "ValidateValue" )
DEBUGOUT( NewValue )
DEBUGOUT( "Change the Cancel parameter for ValidateValue event to accept/decline the newly value." )
Cancel = .T.
DEBUGOUT( "You can not leave the cell until the Cancel is False." )
endwith
with thisform.Grid1
.BeginUpdate
.CauseValidateValue = -1
.Columns.Add("Date").Editor.EditType = 7
.Columns.Add("Text").Editor.EditType = 1
with .Items
.DefaultItem = .AddItem({^2001-1-1})
.CellValue(0,1) = "text"
.DefaultItem = .AddItem({^2001-1-1})
.CellValue(0,1) = "text"
.DefaultItem = .AddItem({^2001-1-1})
.CellValue(0,1) = "text"
.DefaultItem = .AddItem({^2001-1-1})
.CellValue(0,1) = "text"
.DefaultItem = .AddItem({^2001-1-1})
.CellValue(0,1) = "text"
endwith
.EndUpdate
endwith
|
690
|
Is there any way to add auto-numbering
![](images/exgridq690.png)
with thisform.Grid1
with .Columns
.Add("Items")
with .Add("Pos")
.FormatColumn = "1 pos ''"
.Position = 0
endwith
endwith
with .Items
.AddItem("Item 1")
.AddItem("Item 2")
.AddItem("Item 3")
endwith
endwith
|
689
|
Does your control supports multiple lines tooltip
![](images/exgridq689.png)
with thisform.Grid1
.Object.HTMLPicture("pic1") = "c:\exontrol\images\zipdisk.gif"
.ToolTipDelay = 1
var_s = "<br><font Tahoma;10>This</font> is a <b>multi-lines</b> tooltip assigned to a column. The tooltip supports built-in HTML tags, i"
var_s = var_s + "cons and pictures.<br><br><br><img>pic1</img> picture ... <br><br>"
.Columns.Add("tootip").ToolTip = var_s
endwith
|
688
|
How can I prevent highlighting the column from the cursor - point
![](images/exgridq688.png)
with thisform.Grid1
var_s = "gBFLBCJwBAEHhEJAEGg4BI0IQAAYAQGKIYBkAKBQAGaAoDDUOQzQwAAxDKKUEwsACEIrjKCYVgOHYYRrIMYgBCMJhLEoaZLhEZRQiqDYtRDFQBSDDcPw/EaRZohGaYJg"
var_s = var_s + "EgI="
.VisualAppearance.Add(1,var_s)
.Object.Background(32) = 0x1000000
.Columns.Add("S").Width = 32
.Columns.Add("Level 1").LevelKey = 1
.Columns.Add("Level 2").LevelKey = 1
.Columns.Add("Level 3").LevelKey = 1
.Columns.Add("E1").Width = 32
.Columns.Add("E2").Width = 32
.Columns.Add("E3").Width = 32
.Columns.Add("E4").Width = 32
endwith
|
687
|
Is it possible display numbers in the same format no matter of regional settings in the control panel
![](images/exgridq687.png)
with thisform.Grid1
.BeginUpdate
.Columns.Add("Def").Def(17) = 1
with .Items
h = .AddItem(100000.27)
.DefaultItem = h
.FormatCell(0,0) = "(value format '') + ' <fgcolor=808080>(default positive)'"
h = .AddItem(100000.27)
.DefaultItem = h
.FormatCell(0,0) = "(value format '2|.|3|,|1|1')"
h = .AddItem(-100000.27)
.DefaultItem = h
.FormatCell(0,0) = "(value format '') + ' <fgcolor=808080>(default negative)'"
h = .AddItem(-100000.27)
.DefaultItem = h
.FormatCell(0,0) = "(value format '2|.|3|,|1|1')"
endwith
.EndUpdate
endwith
|
686
|
Is it possible to add a 0 for numbers less than 1 instead .7 to show 0.8
![](images/exgridq686.png)
with thisform.Grid1
.BeginUpdate
.Columns.Add("Def").Def(17) = 1
with .Items
h = .AddItem(0.27)
.DefaultItem = h
.FormatCell(0,0) = "(value format '') + ' <fgcolor=808080>(default)'"
h = .AddItem(0.27)
.DefaultItem = h
.FormatCell(0,0) = "(value format '|||||0') + ' <fgcolor=808080>(Display no leading zeros)'"
endwith
.EndUpdate
endwith
|
685
|
How can I specify the format for negative numbers
![](images/exgridq685.png)
with thisform.Grid1
.BeginUpdate
.Columns.Add("Def").Def(17) = 1
with .Items
h = .AddItem(-100000.27)
.DefaultItem = h
.FormatCell(0,0) = "(value format '') + ' <fgcolor=808080>(default)'"
h = .AddItem(-100000.27)
.DefaultItem = h
.FormatCell(0,0) = "(value format '||||1') + ' <fgcolor=808080>(Negative sign, number; for example, -1.1)'"
endwith
.EndUpdate
endwith
|
684
|
Is it possible to change the grouping character when display numbers
![](images/exgridq684.png)
with thisform.Grid1
.BeginUpdate
.Columns.Add("Def").Def(17) = 1
with .Items
h = .AddItem(100000.27)
.DefaultItem = h
.FormatCell(0,0) = "(value format '') + ' <fgcolor=808080>(default)'"
h = .AddItem(100000.27)
.DefaultItem = h
.FormatCell(0,0) = "(value format '|||-') + ' <fgcolor=808080>(grouping character is -)'"
endwith
.EndUpdate
endwith
|
683
|
How can I display numbers with 2 digits in each group
![](images/exgridq683.png)
with thisform.Grid1
.BeginUpdate
.Columns.Add("Def").Def(17) = 1
with .Items
h = .AddItem(100000.27)
.DefaultItem = h
.FormatCell(0,0) = "(value format '') + ' <fgcolor=808080>(default)'"
h = .AddItem(100000.27)
.DefaultItem = h
.FormatCell(0,0) = "(value format '||2') + ' <fgcolor=808080>(grouping by 2 digits)'"
endwith
.EndUpdate
endwith
|
682
|
How can I display my numbers using a different decimal separator
![](images/exgridq682.png)
with thisform.Grid1
.BeginUpdate
.Columns.Add("Def").Def(17) = 1
with .Items
h = .AddItem(100.27)
.DefaultItem = h
.FormatCell(0,0) = "(value format '') + ' <fgcolor=808080>(default)'"
h = .AddItem(100.27)
.DefaultItem = h
.FormatCell(0,0) = "(value format '|;') + ' <fgcolor=808080>(decimal separator is <b>;</b>)'"
endwith
.EndUpdate
endwith
|
681
|
Is it possible to display the numbers using 3 (three) digits
![](images/exgridq681.png)
with thisform.Grid1
.BeginUpdate
.Columns.Add("Def").Def(17) = 1
with .Items
h = .AddItem(100.27)
.DefaultItem = h
.FormatCell(0,0) = "(value format '') + ' <fgcolor=808080>(default)'"
h = .AddItem(100.27)
.DefaultItem = h
.FormatCell(0,0) = "(value format '3') + ' <fgcolor=808080>(3 digits)'"
h = .AddItem(100.27)
.DefaultItem = h
.FormatCell(0,0) = "(value format 2) + ' <fgcolor=808080>(2 digits)'"
h = .AddItem(100.27)
.DefaultItem = h
.FormatCell(0,0) = "(value format 1) + ' <fgcolor=808080>(1 digit)'"
endwith
.EndUpdate
endwith
|
680
|
Is there any option to show the tooltip programmatically
![](images/exgridq680.png)
*** MouseMove event - Occurs when the user moves the mouse. ***
LPARAMETERS Button,Shift,X,Y
with thisform.Grid1
.ShowToolTip(.ItemFromPoint(-1,-1,c,hit),"","8","8")
endwith
with thisform.Grid1
.BeginUpdate
.Columns.Add("Def")
with .Items
.AddItem("Item 1")
.AddItem("Item 2")
.AddItem("Item 3")
endwith
.EndUpdate
endwith
|
679
|
How can I specify the column's width to be the same for all columns
![](images/exgridq679.png)
with thisform.Grid1
with .Columns
.Add("A")
.Add("B")
.Add("C")
endwith
.DrawGridLines = -1
.ColumnAutoResize = .T.
endwith
|
678
|
How can I set the column's width to my desired width
![](images/exgridq678.png)
with thisform.Grid1
.ColumnAutoResize = .F.
with .Columns
.Add("A").Width = 128
.Add("B").Width = 128
endwith
.DrawGridLines = -1
endwith
|
677
|
Is it possible to format numbers
![](images/exgridq677.png)
with thisform.Grid1
.BeginUpdate
.MarkSearchColumn = .F.
with .Columns
.Add("Name")
with .Add("A")
.SortType = 1
.AllowSizing = .F.
.Width = 36
.FormatColumn = "len(value) ? value + ' +'"
.Editor.EditType = 4
endwith
with .Add("B")
.SortType = 1
.AllowSizing = .F.
.Width = 36
.FormatColumn = "len(value) ? value + ' +'"
.Editor.EditType = 4
endwith
with .Add("C")
.SortType = 1
.AllowSizing = .F.
.Width = 36
.FormatColumn = "len(value) ? value + ' ='"
.Editor.EditType = 4
endwith
with .Add("A+B+C")
.SortType = 1
.Width = 64
.ComputedField = "dbl(%1)+dbl(%2)+dbl(%3)"
var_s = "type(value) in (0,1) ? 'null' : ( dbl(value)<0 ? '<fgcolor=FF0000>'+ (value format '2|.|3|,|1' ) : (dbl(value)>0 ? '<fgcolor=000"
var_s = var_s + "0FF>+'+(value format '2|.|3|,' ): '0.00') )"
.FormatColumn = var_s
.Def(17) = 1
endwith
endwith
with .Items
h = .AddItem("Root")
.DefaultItem = h
.CellValueFormat(0,4) = 2
h1 = .InsertItem(h,Null,"Child 1")
.DefaultItem = h1
.CellValue(0,1) = 7
.DefaultItem = h1
.CellValue(0,2) = 3
.DefaultItem = h1
.CellValue(0,3) = 1
h1 = .InsertItem(h,Null,"Child 2")
.DefaultItem = h1
.CellValue(0,1) = -2
.DefaultItem = h1
.CellValue(0,2) = -2
.DefaultItem = h1
.CellValue(0,3) = -4
h1 = .InsertItem(h,Null,"Child 3")
.DefaultItem = h1
.CellValue(0,1) = 2
.DefaultItem = h1
.CellValue(0,2) = 2
.DefaultItem = h1
.CellValue(0,3) = -4
.DefaultItem = h
.ExpandItem(0) = .T.
endwith
.EndUpdate
endwith
|
676
|
How can I collapse all items
![](images/exgridq676.png)
with thisform.Grid1
.BeginUpdate
.LinesAtRoot = -1
.Columns.Add("Items")
with .Items
h = .AddItem("Root 1")
.InsertItem(h,Null,"Child 1")
.InsertItem(h,Null,"Child 2")
h = .AddItem("Root 2")
.InsertItem(h,Null,"Child 1")
.InsertItem(h,Null,"Child 2")
.ExpandItem(0) = .F.
endwith
.EndUpdate
endwith
|
675
|
How can I expand all items
![](images/exgridq675.png)
with thisform.Grid1
.BeginUpdate
.LinesAtRoot = -1
.Columns.Add("Items")
with .Items
h = .AddItem("Root 1")
.InsertItem(h,Null,"Child 1")
.InsertItem(h,Null,"Child 2")
h = .AddItem("Root 2")
.InsertItem(h,Null,"Child 1")
.InsertItem(h,Null,"Child 2")
.ExpandItem(0) = .T.
endwith
.EndUpdate
endwith
|
674
|
Can I display a total field without having to add a child item
![](images/exgridq674.png)
with thisform.Grid1
.BeginUpdate
with .Columns.Add("Numbers")
.SortType = 1
with .Editor
.EditType = 4
.Numeric = 1
endwith
endwith
with .Items
.AddItem(1)
.AddItem(2)
.AddItem(3)
.AddItem(4)
.LockedItemCount(2) = 1
h = .LockedItem(2,0)
.DefaultItem = h
.CellValue(0,0) = "sum(all,dir,dbl(%0))"
.DefaultItem = h
.SortableItem(0) = .F.
.DefaultItem = h
.CellValueFormat(0,0) = 4
.DefaultItem = h
.CellHAlignment(0,0) = 2
.DefaultItem = h
.FormatCell(0,0) = "'SUM: '+value"
endwith
.EndUpdate
endwith
|
673
|
Can I display the number of child items
![](images/exgridq673.png)
with thisform.Grid1
.BeginUpdate
.LinesAtRoot = 1
.Columns.Add("")
with .Items
h = .AddItem("Root 1")
hx = .SplitCell(h,0)
.CellValue(0,hx) = "count(current,dir,1)"
.CellValueFormat(0,hx) = 4
.FormatCell(0,hx) = "'Childs: ' + value"
.InsertItem(h,Null,"Child 1")
.InsertItem(h,Null,"Child 2")
.DefaultItem = h
.ExpandItem(0) = .T.
h = .AddItem("Root 2")
hx = .SplitCell(h,0)
.CellValue(0,hx) = "count(current,dir,1)"
.CellValueFormat(0,hx) = 4
.FormatCell(0,hx) = "'Childs: ' + value"
.InsertItem(h,Null,"Child 1")
.InsertItem(h,Null,"Child 2")
.InsertItem(h,Null,"Child 3")
.InsertItem(h,Null,"Child 4")
endwith
.EndUpdate
endwith
|
672
|
My field does not display the correctly computed value if I enter data using the control's editors ( concatenation of strings ). What am I doing wrong
![](images/exgridq672.png)
with thisform.Grid1
.BeginUpdate
.Columns.Add("T")
with .Columns.Add("A").Editor
.Numeric = .T.
.EditType = 4
endwith
with .Columns.Add("B").Editor
.Numeric = .T.
.EditType = 4
endwith
.Columns.Add("A+B")
with .Items
h = .AddItem("Incorrect")
.DefaultItem = h
.CellToolTip(0,0) = "Just type a number in the column A or B. The result will be concaternated"
.DefaultItem = h
.CellValue(0,1) = "10"
.DefaultItem = h
.CellValue(0,2) = "20"
.DefaultItem = h
.CellValue(0,3) = "currency(%1+%2)"
.DefaultItem = h
.CellValueFormat(0,3) = 2
h = .AddItem("Correct")
.DefaultItem = h
.CellValue(0,1) = 10
.DefaultItem = h
.CellValue(0,2) = 20
.DefaultItem = h
.CellValue(0,3) = "currency(dbl(%1)+dbl(%2))"
.DefaultItem = h
.CellValueFormat(0,3) = 2
endwith
.EndUpdate
endwith
|
671
|
The CellValue/CellCaption property gets the result of a computed/total field with text formatting. Is it possible to get that value without text formatting
![](images/exgridq671.png)
with thisform.Grid1
.BeginUpdate
.Columns.Add("A").Editor.EditType = 4
.Columns.Add("B").Editor.EditType = 4
.Columns.Add("A+B")
with .Items
h = .AddItem(10)
.DefaultItem = h
.CellValue(0,1) = 20
.DefaultItem = h
.CellValueFormat(0,2) = 2
.DefaultItem = h
.CellValue(0,2) = "currency(dbl(%0)+dbl(%1))"
DEBUGOUT( "CellCaption returns " )
DEBUGOUT( .CellCaption(h,2) )
DEBUGOUT( "CellValue returns " )
DEBUGOUT( .CellValue(h,2) )
DEBUGOUT( "ComputeValue returns " )
DEBUGOUT( .ComputeValue("dbl(%0)+dbl(%1)",h,0,.CellValueFormat(h,2)) )
endwith
.EndUpdate
endwith
|
670
|
Can I get the result of a specified formula as your control does using the ComputedField property
with thisform.Grid1
.BeginUpdate
.Columns.Add("A")
.Columns.Add("B")
with .Items
h = .AddItem(10)
.DefaultItem = h
.CellValue(0,1) = 20
DEBUGOUT( "A+B is " )
DEBUGOUT( .ComputeValue("dbl(%0)+dbl(%1)",h,0,2) )
endwith
.EndUpdate
endwith
|
669
|
Is it possible to get the text without HTML formatting
![](images/exgridq669.png)
with thisform.Grid1
.BeginUpdate
.Columns.Add("")
with .Items
h = .AddItem("<b>bold</b>")
DEBUGOUT( .ComputeValue(.CellValue(h,0),h,0,1) )
endwith
.EndUpdate
endwith
|
668
|
Can I specify an item to be a separator
![](images/exgridq668.png)
with thisform.Grid1
.BeginUpdate
.TreeColumnIndex = -1
.SortOnClick = 0
.Columns.Add("Numbers")
with .Items
.AddItem(1)
.AddItem(2)
h = .AddItem("separator")
.DefaultItem = h
.SelectableItem(0) = .F.
.DefaultItem = h
.ItemDivider(0) = 0
.DefaultItem = h
.ItemDividerLineAlignment(0) = 1
.DefaultItem = h
.ItemDividerLine(0) = 5
.DefaultItem = h
.CellHAlignment(0,0) = 1
.AddItem(3)
.AddItem(4)
endwith
.EndUpdate
endwith
|
667
|
How can I count only non-zero values
![](images/exgridq667.png)
with thisform.Grid1
.BeginUpdate
.Columns.Add("Numbers").SortType = 1
with .Items
.AddItem(1)
.AddItem(2)
.AddItem(0)
.AddItem(0)
.AddItem(0)
.AddItem(0)
.AddItem(3)
.AddItem(4)
h = .AddItem("sum(all,dir,dbl(%0)?1:0)")
.DefaultItem = h
.SortableItem(0) = .F.
.DefaultItem = h
.CellValueFormat(0,0) = 4
.DefaultItem = h
.CellHAlignment(0,0) = 2
.DefaultItem = h
.FormatCell(0,0) = "'COUNT non-zero: '+value"
endwith
.EndUpdate
endwith
|
666
|
How can I add a AVG ( average ) field
![](images/exgridq666.png)
with thisform.Grid1
.BeginUpdate
.Columns.Add("Numbers").SortType = 1
with .Items
.AddItem(1)
.AddItem(2)
.AddItem(3)
.AddItem(4)
h = .AddItem("avg(all,dir,dbl(%0))")
.DefaultItem = h
.SortableItem(0) = .F.
.DefaultItem = h
.CellValueFormat(0,0) = 4
.DefaultItem = h
.CellHAlignment(0,0) = 2
.DefaultItem = h
.FormatCell(0,0) = "'AVG: '+value"
endwith
.EndUpdate
endwith
|
665
|
How can I add a COUNT field
![](images/exgridq665.png)
with thisform.Grid1
.BeginUpdate
.Columns.Add("Numbers").SortType = 1
with .Items
.AddItem(1)
.AddItem(2)
.AddItem(3)
.AddItem(4)
h = .AddItem("count(all,dir,0)")
.DefaultItem = h
.SortableItem(0) = .F.
.DefaultItem = h
.CellValueFormat(0,0) = 4
.DefaultItem = h
.CellHAlignment(0,0) = 2
.DefaultItem = h
.FormatCell(0,0) = "'COUNT: '+value"
endwith
.EndUpdate
endwith
|
664
|
How can I add a MAX field
![](images/exgridq664.png)
with thisform.Grid1
.BeginUpdate
.Columns.Add("Numbers").SortType = 1
with .Items
.AddItem(1)
.AddItem(2)
.AddItem(3)
.AddItem(4)
h = .AddItem("max(all,dir,dbl(%0))")
.DefaultItem = h
.SortableItem(0) = .F.
.DefaultItem = h
.CellValueFormat(0,0) = 4
.DefaultItem = h
.CellHAlignment(0,0) = 2
.DefaultItem = h
.FormatCell(0,0) = "'MAX: '+value"
endwith
.EndUpdate
endwith
|
663
|
How can I add a MIN or MAX field (for numbers)
![](images/exgridq663.png)
with thisform.Grid1
.BeginUpdate
.Columns.Add("Numbers").SortType = 1
with .Items
.AddItem(11)
.AddItem(21)
.AddItem(3)
.AddItem(4)
h = .AddItem("min(all,dir,dbl(%0))")
.DefaultItem = h
.SortableItem(0) = .F.
.DefaultItem = h
.CellValueFormat(0,0) = 4
.DefaultItem = h
.CellHAlignment(0,0) = 2
.DefaultItem = h
.FormatCell(0,0) = "'MIN: '+value"
h = .AddItem("max(all,dir,dbl(%0))")
.DefaultItem = h
.SortableItem(0) = .F.
.DefaultItem = h
.CellValueFormat(0,0) = 4
.DefaultItem = h
.CellHAlignment(0,0) = 2
.DefaultItem = h
.FormatCell(0,0) = "'MAX: '+value"
endwith
.EndUpdate
endwith
|
662
|
How can I add a SUM field
![](images/exgridq662.png)
with thisform.Grid1
.BeginUpdate
.Columns.Add("Numbers").SortType = 1
with .Items
.AddItem(1)
.AddItem(2)
.AddItem(3)
.AddItem(4)
h = .AddItem("sum(all,dir,dbl(%0))")
.DefaultItem = h
.SortableItem(0) = .F.
.DefaultItem = h
.CellValueFormat(0,0) = 4
.DefaultItem = h
.CellHAlignment(0,0) = 2
.DefaultItem = h
.FormatCell(0,0) = "'SUM: '+value"
endwith
.EndUpdate
endwith
|
661
|
How can I add total and subtotals fields
![](images/exgridq661.png)
*** Change event - Occurs when the user changes the cell's content. ***
LPARAMETERS Item,ColIndex,NewValue
with thisform.Grid1
.Refresh
endwith
with thisform.Grid1
.BeginUpdate
.LinesAtRoot = 1
.Columns.Add("Members")
with .Columns.Add("Values")
.FormatColumn = "currency(value)"
with .Editor
.EditType = 4
.Numeric = .T.
endwith
endwith
with .Items
h = .AddItem("Group 1")
.DefaultItem = h
.ItemBold(0) = .T.
.DefaultItem = h
.CellEditorVisible(0,1) = .F.
.DefaultItem = h
.CellValue(0,1) = "sum(current,dir,dbl(%1))"
.DefaultItem = h
.CellValueFormat(0,1) = 5 && ValueFormatEnum.exTotalField Or ValueFormatEnum.exHTML
.DefaultItem = h
.CellHAlignment(0,1) = 2
.DefaultItem = .InsertItem(h,Null,"Child 1")
.CellValue(0,1) = 10
.DefaultItem = .InsertItem(h,Null,"Child 2")
.CellValue(0,1) = 20
.DefaultItem = .InsertItem(h,Null,"Child 3")
.CellValue(0,1) = 30
.DefaultItem = h
.ExpandItem(0) = .T.
h = .AddItem("Group 2")
.DefaultItem = h
.ItemBold(0) = .T.
.DefaultItem = h
.CellEditorVisible(0,1) = .F.
.DefaultItem = h
.CellValue(0,1) = "sum(current,dir,dbl(%1))"
.DefaultItem = h
.CellValueFormat(0,1) = 5 && ValueFormatEnum.exTotalField Or ValueFormatEnum.exHTML
.DefaultItem = h
.CellHAlignment(0,1) = 2
.DefaultItem = .InsertItem(h,Null,"Child 1")
.CellValue(0,1) = 5
.DefaultItem = .InsertItem(h,Null,"Child 2")
.CellValue(0,1) = 15
.DefaultItem = .InsertItem(h,Null,"Child 3")
.CellValue(0,1) = 35
h = .AddItem("total")
.DefaultItem = h
.CellValue(0,1) = "sum(all,rec,dbl(%1))"
.DefaultItem = h
.CellValueFormat(0,1) = 5 && ValueFormatEnum.exTotalField Or ValueFormatEnum.exHTML
.DefaultItem = h
.CellEditorVisible(0,1) = .F.
.DefaultItem = h
.FormatCell(0,1) = "'Total: <b>' + currency(value)"
.DefaultItem = h
.CellHAlignment(0,1) = 2
.DefaultItem = h
.ItemDivider(0) = 1
.DefaultItem = h
.ItemDividerLineAlignment(0) = 1
.DefaultItem = h
.ItemDividerLine(0) = 2
.DefaultItem = h
.SortableItem(0) = .F.
endwith
.EndUpdate
endwith
|
660
|
Is is possible to have subtotal items, and a grand total item
![](images/exgridq660.png)
*** Change event - Occurs when the user changes the cell's content. ***
LPARAMETERS Item,ColIndex,NewValue
with thisform.Grid1
.Refresh
endwith
with thisform.Grid1
.BeginUpdate
.BackColor = RGB(255,255,255)
.LinesAtRoot = 1
.ShowFocusRect = .F.
.Columns.Add("Members")
with .Columns.Add("Values")
.FormatColumn = "currency(value)"
with .Editor
.EditType = 4
.Numeric = .T.
endwith
endwith
with .Items
h = .AddItem("Group 1")
.DefaultItem = h
.ItemBold(0) = .T.
.DefaultItem = h
.SortableItem(0) = .F.
.DefaultItem = h
.CellEditorVisible(0,1) = .F.
.DefaultItem = h
.FormatCell(0,1) = " "
.DefaultItem = .InsertItem(h,Null,"Child 1")
.CellValue(0,1) = 10
.DefaultItem = .InsertItem(h,Null,"Child 2")
.CellValue(0,1) = 20
.DefaultItem = .InsertItem(h,Null,"Child 3")
.CellValue(0,1) = 30
hT = .InsertItem(h,Null,"subtotal")
.DefaultItem = hT
.CellHAlignment(0,1) = 2
.DefaultItem = hT
.CellEditorVisible(0,1) = .F.
.DefaultItem = hT
.CellValue(0,1) = "sum(parent,dir,dbl(%1))"
.DefaultItem = hT
.CellValueFormat(0,1) = 5 && ValueFormatEnum.exTotalField Or ValueFormatEnum.exHTML
.DefaultItem = hT
.FormatCell(0,1) = "'subtotal: <b>' + currency(value)"
.DefaultItem = hT
.ItemDivider(0) = 1
.DefaultItem = hT
.ItemDividerLineAlignment(0) = 1
.DefaultItem = hT
.SortableItem(0) = .F.
.DefaultItem = hT
.SelectableItem(0) = .F.
.DefaultItem = hT
.ItemDividerLine(0) = 3
.DefaultItem = h
.ExpandItem(0) = .T.
h = .AddItem("Group 2")
.DefaultItem = h
.ItemBold(0) = .T.
.DefaultItem = h
.SortableItem(0) = .F.
.DefaultItem = h
.FormatCell(0,1) = " "
.DefaultItem = h
.CellEditorVisible(0,1) = .F.
.DefaultItem = .InsertItem(h,Null,"Child 1")
.CellValue(0,1) = 15
.DefaultItem = .InsertItem(h,Null,"Child 2")
.CellValue(0,1) = 25
.DefaultItem = .InsertItem(h,Null,"Child 3")
.CellValue(0,1) = 18
hT = .InsertItem(h,Null,"subtotal")
.DefaultItem = hT
.CellHAlignment(0,1) = 2
.DefaultItem = hT
.CellEditorVisible(0,1) = .F.
.DefaultItem = hT
.CellValue(0,1) = "sum(parent,dir,dbl(%1))"
.DefaultItem = hT
.CellValueFormat(0,1) = 5 && ValueFormatEnum.exTotalField Or ValueFormatEnum.exHTML
.DefaultItem = hT
.FormatCell(0,1) = "'subtotal: <b>' + currency(value)"
.DefaultItem = hT
.ItemDivider(0) = 1
.DefaultItem = hT
.ItemDividerLineAlignment(0) = 1
.DefaultItem = hT
.ItemDividerLine(0) = 3
.DefaultItem = hT
.SortableItem(0) = .F.
.DefaultItem = hT
.SelectableItem(0) = .F.
.DefaultItem = h
.ExpandItem(0) = .T.
h = .AddItem("total")
.DefaultItem = h
.CellValue(0,1) = "sum(all,rec,dbl(%1))"
.DefaultItem = h
.CellValueFormat(0,1) = 5 && ValueFormatEnum.exTotalField Or ValueFormatEnum.exHTML
.DefaultItem = h
.CellEditorVisible(0,1) = .F.
.DefaultItem = h
.FormatCell(0,1) = "'Total: <b><font ;11>' + currency(value)"
.DefaultItem = h
.CellHAlignment(0,1) = 1
.DefaultItem = h
.ItemDivider(0) = 1
.DefaultItem = h
.ItemDividerLineAlignment(0) = 1
.DefaultItem = h
.ItemDividerLine(0) = 2
.DefaultItem = h
.SortableItem(0) = .F.
.DefaultItem = h
.SelectableItem(0) = .F.
endwith
.EndUpdate
endwith
|
659
|
Is it possible to have a total field for each column
![](images/exgridq659.png)
*** Change event - Occurs when the user changes the cell's content. ***
LPARAMETERS Item,ColIndex,NewValue
with thisform.Grid1
.Refresh
endwith
with thisform.Grid1
.BeginUpdate
with .Columns.Add("C1")
with .Editor
.Numeric = -1
.EditType = 4
endwith
.SortType = 1
endwith
with .Columns.Add("C2")
with .Editor
.Numeric = -1
.EditType = 4
endwith
.SortType = 1
endwith
with .Items
.LockedItemCount(2) = 1
h = .LockedItem(2,0)
.DefaultItem = h
.ItemBackColor(0) = RGB(240,240,240)
.DefaultItem = h
.ItemBold(0) = .T.
.DefaultItem = h
.CellValue(0,0) = "sum(all,dir,dbl(%0))"
.DefaultItem = h
.CellValueFormat(0,0) = 4
.DefaultItem = h
.CellValue(0,1) = "sum(all,dir,dbl(%1))"
.DefaultItem = h
.CellValueFormat(0,1) = 4
endwith
with .Items
.DefaultItem = .AddItem(10)
.CellValue(0,1) = 12
.DefaultItem = .AddItem(25)
.CellValue(0,1) = 5
.DefaultItem = .AddItem(31)
.CellValue(0,1) = 17
.DefaultItem = .AddItem(48)
.CellValue(0,1) = 22
endwith
.EndUpdate
endwith
|
658
|
How can I add a total field for a DataSource being used
![](images/exgridq658.png)
*** Change event - Occurs when the user changes the cell's content. ***
LPARAMETERS Item,ColIndex,NewValue
with thisform.Grid1
.Refresh
endwith
with thisform.Grid1
.ColumnAutoResize = .F.
.ContinueColumnScroll = .F.
rs = CreateObject("ADOR.Recordset")
with rs
.Open("Orders","Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb",3,3)
endwith
.DataSource = rs
with .Items
.LockedItemCount(0) = 1
h = .LockedItem(0,0)
.DefaultItem = h
.ItemDivider(0) = 0
.DefaultItem = h
.CellValueFormat(0,0) = 5 && ValueFormatEnum.exTotalField Or ValueFormatEnum.exHTML
.DefaultItem = h
.CellValue(0,0) = "sum(all,dir,%1)"
endwith
endwith
|
657
|
How can I add a total field
![](images/exgridq657.png)
*** Change event - Occurs when the user changes the cell's content. ***
LPARAMETERS Item,ColIndex,NewValue
with thisform.Grid1
.Refresh
endwith
with thisform.Grid1
.BeginUpdate
with .Columns.Add("Numbers")
with .Editor
.Numeric = -1
.EditType = 4
endwith
.SortType = 1
endwith
with .Items
.LockedItemCount(0) = 1
h = .LockedItem(0,0)
.DefaultItem = h
.ItemBackColor(0) = RGB(240,240,240)
.DefaultItem = h
.CellValue(0,0) = "sum(all,dir,dbl(%0))"
.DefaultItem = h
.CellValueFormat(0,0) = 4
.DefaultItem = h
.CellHAlignment(0,0) = 2
.DefaultItem = h
.FormatCell(0,0) = "'Total: '+value"
endwith
with .Items
.AddItem(10)
.AddItem(25)
.AddItem(31)
.AddItem(48)
endwith
.EndUpdate
endwith
|
656
|
How can I add a total field
![](images/exgridq656.png)
*** Change event - Occurs when the user changes the cell's content. ***
LPARAMETERS Item,ColIndex,NewValue
with thisform.Grid1
.Refresh
endwith
with thisform.Grid1
.BeginUpdate
with .Columns.Add("Items").Editor
.EditType = 4
.Numeric = .T.
endwith
with .Items
h = .AddItem("Group 1")
.DefaultItem = h
.CellEditorVisible(0,0) = .F.
.InsertItem(h,Null,10)
.InsertItem(h,Null,20)
.InsertItem(h,Null,30)
hT = .InsertItem(h,Null,"sum(parent,dir,dbl(%0))")
.DefaultItem = hT
.CellEditorVisible(0,0) = .F.
.DefaultItem = hT
.CellValueFormat(0,0) = 5 && ValueFormatEnum.exTotalField Or ValueFormatEnum.exHTML
.DefaultItem = hT
.ItemDivider(0) = 0
.DefaultItem = hT
.ItemDividerLineAlignment(0) = 2
.DefaultItem = hT
.SelectableItem(0) = .F.
.DefaultItem = hT
.SortableItem(0) = .F.
.DefaultItem = h
.ExpandItem(0) = .T.
endwith
.EndUpdate
endwith
|
655
|
Is it possible to specify the cell's value but still want to display some formatted text instead the value
![](images/exgridq655.png)
with thisform.Grid1
.BeginUpdate
.Columns.Add("Value")
.Columns.Add("FormatCell")
with .Items
h = .AddItem(1)
.DefaultItem = h
.CellValue(0,1) = 12
.DefaultItem = h
.FormatCell(0,1) = "currency(value)"
h = .AddItem({^2001-1-1})
.DefaultItem = h
.CellValue(0,1) = {^2001-1-1}
.DefaultItem = h
.CellValueFormat(0,1) = 1
.DefaultItem = h
.FormatCell(0,1) = "longdate(value) replace '2001' with '<b>2001</b>'"
endwith
.EndUpdate
endwith
|
654
|
How can I simulate displaying groups
![](images/exgridq654.png)
with thisform.Grid1
.HasLines = 0
.ScrollBySingleLine = .T.
with .Columns
.Add("Name")
.Add("A")
.Add("B")
.Add("C")
endwith
with .Items
h = .AddItem("Group 1")
.DefaultItem = h
.CellHAlignment(0,0) = 1
.DefaultItem = h
.ItemDivider(0) = 0
.DefaultItem = h
.ItemDividerLineAlignment(0) = 3
.DefaultItem = h
.ItemHeight(0) = 24
.DefaultItem = h
.SortableItem(0) = .F.
h1 = .InsertItem(h,Null,"Child 1")
.DefaultItem = h1
.CellValue(0,1) = 1
.DefaultItem = h1
.CellValue(0,2) = 2
.DefaultItem = h1
.CellValue(0,3) = 3
h1 = .InsertItem(h,Null,"Child 2")
.DefaultItem = h1
.CellValue(0,1) = 4
.DefaultItem = h1
.CellValue(0,2) = 5
.DefaultItem = h1
.CellValue(0,3) = 6
.DefaultItem = h
.ExpandItem(0) = .T.
h = .AddItem("Group 2")
.DefaultItem = h
.CellHAlignment(0,0) = 1
.DefaultItem = h
.ItemDivider(0) = 0
.DefaultItem = h
.ItemDividerLineAlignment(0) = 3
.DefaultItem = h
.ItemHeight(0) = 24
.DefaultItem = h
.SortableItem(0) = .F.
h1 = .InsertItem(h,Null,"Child 1")
.DefaultItem = h1
.CellValue(0,1) = 1
.DefaultItem = h1
.CellValue(0,2) = 2
.DefaultItem = h1
.CellValue(0,3) = 3
h1 = .InsertItem(h,Null,"Child 2")
.DefaultItem = h1
.CellValue(0,1) = 4
.DefaultItem = h1
.CellValue(0,2) = 5
.DefaultItem = h1
.CellValue(0,3) = 6
.DefaultItem = h
.ExpandItem(0) = .T.
endwith
endwith
|
653
|
Is it possible to specify the cell's value but still want to display some formatted text instead the value
![](images/exgridq653.png)
with thisform.Grid1
.BeginUpdate
.MarkSearchColumn = .F.
with .Columns
.Add("Name")
with .Add("Values")
.SortType = 1
.AllowSizing = .F.
.Width = 64
.FormatColumn = "((0:=dbl(value)) < 10? '<fgcolor=808080><font ;7>' :'<b>') + currency(=:0)"
.Def(17) = 1
endwith
endwith
with .Items
h = .AddItem("Root")
.DefaultItem = h
.FormatCell(0,1) = "'<none>'"
.DefaultItem = .InsertItem(h,Null,"Child 1")
.CellValue(0,1) = 10
.DefaultItem = .InsertItem(h,Null,"Child 2")
.CellValue(0,1) = 15
.DefaultItem = .InsertItem(h,Null,"Child 3")
.CellValue(0,1) = 25
.DefaultItem = h
.ExpandItem(0) = .T.
endwith
.EndUpdate
endwith
|
652
|
I am using the FormatColumn to display the current currency, but would like hide some values. Is it possible
![](images/exgridq652.png)
with thisform.Grid1
.BeginUpdate
.MarkSearchColumn = .F.
with .Columns
.Add("Name")
with .Add("Values")
.SortType = 1
.AllowSizing = .F.
.Width = 64
.FormatColumn = "((0:=dbl(value)) < 10? '<fgcolor=808080><font ;7>' :'<b>') + currency(=:0)"
.Def(17) = 1
endwith
endwith
with .Items
h = .AddItem("Root")
.DefaultItem = h
.FormatCell(0,1) = " "
.DefaultItem = .InsertItem(h,Null,"Child 1")
.CellValue(0,1) = 10
.DefaultItem = .InsertItem(h,Null,"Child 2")
.CellValue(0,1) = 15
.DefaultItem = .InsertItem(h,Null,"Child 3")
.CellValue(0,1) = 25
.DefaultItem = h
.ExpandItem(0) = .T.
endwith
.EndUpdate
endwith
|
651
|
How can I specify an item to be always the first item
![](images/exgridq651.png)
with thisform.Grid1
.BeginUpdate
.TreeColumnIndex = -1
.Columns.Add("Numbers").SortType = 1
with .Items
.AddItem(1)
.AddItem(2)
.AddItem(3)
.AddItem(4)
h = .AddItem("first")
.DefaultItem = h
.ItemPosition(0) = 0
.DefaultItem = h
.CellHAlignment(0,0) = 2
.DefaultItem = h
.SortableItem(0) = .F.
.SortChildren(0,0,.F.)
endwith
.EndUpdate
endwith
|
650
|
How can I specify an item to be always the last item
![](images/exgridq650.png)
with thisform.Grid1
.BeginUpdate
.TreeColumnIndex = -1
.Columns.Add("Numbers").SortType = 1
with .Items
.AddItem(1)
.AddItem(2)
.AddItem(3)
.AddItem(4)
h = .AddItem("last")
.DefaultItem = h
.CellHAlignment(0,0) = 2
.DefaultItem = h
.SortableItem(0) = .F.
.SortChildren(0,0,.T.)
endwith
.EndUpdate
endwith
|
649
|
Can I allow sorting only the child items
![](images/exgridq649.png)
with thisform.Grid1
.BeginUpdate
.Columns.Add("Childs")
with .Items
h = .AddItem("Root 1")
.DefaultItem = h
.SortableItem(0) = .F.
.InsertItem(h,Null,"Child 1")
.InsertItem(h,Null,"Child 2")
.DefaultItem = h
.ExpandItem(0) = .T.
h = .AddItem("Root 2")
.DefaultItem = h
.SortableItem(0) = .F.
.InsertItem(h,Null,"Child 1")
.InsertItem(h,Null,"Child 2")
.DefaultItem = h
.ExpandItem(0) = .T.
endwith
.EndUpdate
endwith
|
648
|
Can I specify a terminal item so it will mark the end of childs
![](images/exgridq648.png)
with thisform.Grid1
.BeginUpdate
.ScrollBySingleLine = .T.
.Columns.Add("P1")
with .Items
h = .AddItem("Root 1")
.InsertItem(h,Null,"Child 1")
.InsertItem(h,Null,"Child 2")
.DefaultItem = h
.ExpandItem(0) = .T.
h = .InsertItem(h,"","")
.DefaultItem = h
.ItemDivider(0) = 0
.DefaultItem = h
.ItemDividerLineAlignment(0) = 1
.DefaultItem = h
.ItemHeight(0) = 2
.DefaultItem = h
.SelectableItem(0) = .F.
.DefaultItem = h
.SortableItem(0) = .F.
h = .AddItem("Root 2")
.InsertItem(h,Null,"Child 1")
.InsertItem(h,Null,"Child 2")
.DefaultItem = h
.ExpandItem(0) = .T.
h = .InsertItem(h,"","")
.DefaultItem = h
.ItemDivider(0) = 0
.DefaultItem = h
.ItemDividerLineAlignment(0) = 1
.DefaultItem = h
.ItemHeight(0) = 2
.DefaultItem = h
.SelectableItem(0) = .F.
.DefaultItem = h
.SortableItem(0) = .F.
endwith
.EndUpdate
endwith
|
647
|
Is it possible to specify an item being unsortable so its position won't be changed after sorting
![](images/exgridq647.png)
with thisform.Grid1
.BeginUpdate
.TreeColumnIndex = -1
.Columns.Add("Numbers").SortType = 1
with .Items
.AddItem(1)
.AddItem(2)
.AddItem(3)
.AddItem(4)
h = .AddItem("top 3")
.DefaultItem = h
.ItemPosition(0) = 3
.DefaultItem = h
.CellHAlignment(0,0) = 2
.DefaultItem = h
.SortableItem(0) = .F.
.SortChildren(0,0,.F.)
endwith
.EndUpdate
endwith
|
646
|
Is it possible to move an item from a parent to another
![](images/exgridq646.png)
with thisform.Grid1
.BeginUpdate
.LinesAtRoot = -1
.Columns.Add("Items")
with .Items
.AddItem("A")
.AddItem("B")
.InsertItem(.AddItem("C"),"","D")
.SetParent(.FindItem("D",0),.FindItem("A",0))
endwith
.EndUpdate
endwith
|
645
|
How can I change the identation for an item
![](images/exgridq645.png)
with thisform.Grid1
.BeginUpdate
.LinesAtRoot = -1
.Columns.Add("Items")
with .Items
.AddItem("A")
.AddItem("B")
.InsertItem(.AddItem("C"),"","D")
.SetParent(.FindItem("D",0),0)
endwith
.EndUpdate
endwith
|
644
|
How can I arrange the control's header on multiple levels
![](images/exgridq644.png)
with thisform.Grid1
.BeginUpdate
.DefaultItemHeight = 48
with .Columns
.Add("Title").Visible = .F.
.Add("FirstName").Visible = .F.
.Add("LastName").Visible = .F.
.Add("Photo").Visible = .F.
with .Add("Address")
.Visible = .F.
.Def(16) = .F.
endwith
with .Add("Personal Info")
.FormatLevel = "3:48,(0/1/2),4:96"
.Def(32) = "3:48,(0/1/2),4:96"
endwith
endwith
with .Items
h = .AddItem("Sales Representative")
.DefaultItem = h
.CellValue(0,1) = "Nancy"
.DefaultItem = h
.CellValue(0,2) = "Davolio"
.DefaultItem = h
.CellPicture(0,3) = thisform.Grid1.ExecuteTemplate("loadpicture(`c:\exontrol\images\zipdisk.gif`)")
.DefaultItem = h
.CellValue(0,4) = "507-20th Ave. E.Apt. 2A"
endwith
.EndUpdate
endwith
|
643
|
How can I filter programatically using more columns
![](images/exgridq643.png)
with thisform.Grid1
.BeginUpdate
with .Columns
.Add("Car")
.Add("Equipment")
endwith
with .Items
.DefaultItem = .AddItem("Mazda")
.CellValue(0,1) = "Air Bag"
.DefaultItem = .AddItem("Toyota")
.CellValue(0,1) = "Air Bag,Air condition"
.DefaultItem = .AddItem("Ford")
.CellValue(0,1) = "Air condition"
.DefaultItem = .AddItem("Nissan")
.CellValue(0,1) = "Air Bag,ABS,ESP"
.DefaultItem = .AddItem("Mazda")
.CellValue(0,1) = "Air Bag, ABS,ESP"
.DefaultItem = .AddItem("Mazda")
.CellValue(0,1) = "ABS,ESP"
endwith
with .Columns.Item("Car")
.FilterType = 240
.Filter = "Mazda"
endwith
with .Columns.Item("Equipment")
.FilterType = 3
.Filter = "*ABS*|*ESP*"
endwith
.ApplyFilter
.EndUpdate
endwith
|
642
|
How can I show the ticks for a single slider field
![](images/exgridq642.png)
with thisform.Grid1
.BeginUpdate
.Columns.Add("Slider").Editor.EditType = 20
with .Items
.AddItem(10)
with .CellEditor(.AddItem(20),0)
.EditType = 20
.Option(53) = 10
endwith
.AddItem(30)
endwith
.EndUpdate
endwith
|
641
|
Is it possible to show ticks for slider fields
![](images/exgridq641.png)
with thisform.Grid1
with .Columns.Add("Slider").Editor
.EditType = 20
.Option(53) = 10
endwith
.Items.AddItem(10)
endwith
|
640
|
Is it possible to colour a particular column, I mean the cell's foreground color
![](images/exgridq640.png)
with thisform.Grid1
.BeginUpdate
with .ConditionalFormats.Add("1")
.ForeColor = RGB(255,0,0)
.ApplyTo = 1 && 0x1
endwith
.MarkSearchColumn = .F.
with .Columns
.Add("Column 1")
.Add("Column 2")
endwith
with .Items
.DefaultItem = .AddItem(0)
.CellValue(0,1) = 1
.DefaultItem = .AddItem(2)
.CellValue(0,1) = 3
.DefaultItem = .AddItem(4)
.CellValue(0,1) = 5
endwith
.EndUpdate
endwith
|
639
|
Is it possible to colour a particular column for specified values
![](images/exgridq639.png)
with thisform.Grid1
.BeginUpdate
with .ConditionalFormats.Add("int(%1) in (3,4,5)")
.BackColor = RGB(255,0,0)
.ApplyTo = 1 && 0x1
endwith
.MarkSearchColumn = .F.
with .Columns
.Add("Column 1")
.Add("Column 2")
endwith
with .Items
.DefaultItem = .AddItem(0)
.CellValue(0,1) = 1
.DefaultItem = .AddItem(2)
.CellValue(0,1) = 3
.DefaultItem = .AddItem(4)
.CellValue(0,1) = 5
endwith
.EndUpdate
endwith
|
638
|
Is it possible to colour a particular column
![](images/exgridq638.png)
with thisform.Grid1
.BeginUpdate
.MarkSearchColumn = .F.
with .Columns
.Add("Column 1")
.Add("Column 2").Def(4) = 255
endwith
with .Items
.DefaultItem = .AddItem(0)
.CellValue(0,1) = 1
.DefaultItem = .AddItem(2)
.CellValue(0,1) = 3
.DefaultItem = .AddItem(4)
.CellValue(0,1) = 5
endwith
.EndUpdate
endwith
|
637
|
How do i get all the children items that are under a certain parent Item handle
with thisform.Grid1
.BeginUpdate
.LinesAtRoot = -1
.Columns.Add("P")
with .Items
h = .AddItem("Root")
.InsertItem(h,Null,"Child 1")
.InsertItem(h,Null,"Child 2")
.DefaultItem = h
.ExpandItem(0) = .T.
endwith
with .Items
hChild = .ItemChild(.FirstVisibleItem)
DEBUGOUT( .CellValue(hChild,0) )
DEBUGOUT( .CellValue(.NextSiblingItem(hChild),0) )
endwith
.EndUpdate
endwith
|
636
|
Is is possible to use HTML tags to display in the filter caption
![](images/exgridq636.png)
with thisform.Grid1
.BeginUpdate
.FilterBarPromptVisible = 1
.FilterBarCaption = "This is a bit of text being displayed in the filter bar."
.Columns.Add("")
with .Items
.AddItem("Item 1")
.AddItem("Item 2")
.AddItem("Item 3")
endwith
.EndUpdate
endwith
|
635
|
How can I find the number of items after filtering
with thisform.Grid1
.BeginUpdate
.Columns.Add("")
with .Items
h = .AddItem("")
.DefaultItem = h
.CellValue(0,0) = .VisibleItemCount
endwith
.EndUpdate
endwith
|
634
|
How can I change the filter caption
![](images/exgridq634.png)
with thisform.Grid1
.BeginUpdate
.ColumnAutoResize = .T.
.ContinueColumnScroll = 0
.FocusColumnIndex = 1
.MarkSearchColumn = .F.
.SearchColumnIndex = 1
.FilterBarPromptVisible = 1
.FilterBarPromptType = 12801 && FilterPromptEnum.exFilterPromptWords Or FilterPromptEnum.exFilterPromptContainsAll
.FilterBarPromptPattern = "london robert"
.FilterBarCaption = "<r>Found: ... "
with .Columns
.Add("Name").Width = 96
.Add("Title").Width = 96
.Add("City")
endwith
with .Items
h0 = .AddItem("Nancy Davolio")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "Seattle"
h0 = .AddItem("Andrew Fuller")
.DefaultItem = h0
.CellValue(0,1) = "Vice President, Sales"
.DefaultItem = h0
.CellValue(0,2) = "Tacoma"
.DefaultItem = h0
.SelectItem(0) = .T.
h0 = .AddItem("Janet Leverling")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "Kirkland"
h0 = .AddItem("Margaret Peacock")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "Redmond"
h0 = .AddItem("Steven Buchanan")
.DefaultItem = h0
.CellValue(0,1) = "Sales Manager"
.DefaultItem = h0
.CellValue(0,2) = "London"
h0 = .AddItem("Michael Suyama")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "London"
h0 = .AddItem("Robert King")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "London"
h0 = .AddItem("Laura Callahan")
.DefaultItem = h0
.CellValue(0,1) = "Inside Sales Coordinator"
.DefaultItem = h0
.CellValue(0,2) = "Seattle"
h0 = .AddItem("Anne Dodsworth")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "London"
endwith
.EndUpdate
endwith
|
633
|
While using the filter prompt is it is possible to use wild characters
![](images/exgridq633.png)
with thisform.Grid1
.BeginUpdate
.ColumnAutoResize = .T.
.ContinueColumnScroll = 0
.FocusColumnIndex = 1
.MarkSearchColumn = .F.
.SearchColumnIndex = 1
.FilterBarPromptVisible = 1
.FilterBarPromptType = 16
.FilterBarPromptPattern = "lon* seat*"
with .Columns
.Add("Name").Width = 96
.Add("Title").Width = 96
.Add("City")
endwith
with .Items
h0 = .AddItem("Nancy Davolio")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "Seattle"
h0 = .AddItem("Andrew Fuller")
.DefaultItem = h0
.CellValue(0,1) = "Vice President, Sales"
.DefaultItem = h0
.CellValue(0,2) = "Tacoma"
.DefaultItem = h0
.SelectItem(0) = .T.
h0 = .AddItem("Janet Leverling")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "Kirkland"
h0 = .AddItem("Margaret Peacock")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "Redmond"
h0 = .AddItem("Steven Buchanan")
.DefaultItem = h0
.CellValue(0,1) = "Sales Manager"
.DefaultItem = h0
.CellValue(0,2) = "London"
h0 = .AddItem("Michael Suyama")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "London"
h0 = .AddItem("Robert King")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "London"
h0 = .AddItem("Laura Callahan")
.DefaultItem = h0
.CellValue(0,1) = "Inside Sales Coordinator"
.DefaultItem = h0
.CellValue(0,2) = "Seattle"
h0 = .AddItem("Anne Dodsworth")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "London"
endwith
.EndUpdate
endwith
|
632
|
How can I list all items that contains any of specified words, not necessary at the beggining
![](images/exgridq632.png)
with thisform.Grid1
.BeginUpdate
.ColumnAutoResize = .T.
.ContinueColumnScroll = 0
.FocusColumnIndex = 1
.MarkSearchColumn = .F.
.SearchColumnIndex = 1
.FilterBarPromptVisible = 1
.FilterBarPromptType = 4610 && FilterPromptEnum.exFilterPromptStartWords Or FilterPromptEnum.exFilterPromptContainsAny
.FilterBarPromptPattern = "london davolio"
with .Columns
.Add("Name").Width = 96
.Add("Title").Width = 96
.Add("City")
endwith
with .Items
h0 = .AddItem("Nancy Davolio")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "Seattle"
h0 = .AddItem("Andrew Fuller")
.DefaultItem = h0
.CellValue(0,1) = "Vice President, Sales"
.DefaultItem = h0
.CellValue(0,2) = "Tacoma"
.DefaultItem = h0
.SelectItem(0) = .T.
h0 = .AddItem("Janet Leverling")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "Kirkland"
h0 = .AddItem("Margaret Peacock")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "Redmond"
h0 = .AddItem("Steven Buchanan")
.DefaultItem = h0
.CellValue(0,1) = "Sales Manager"
.DefaultItem = h0
.CellValue(0,2) = "London"
h0 = .AddItem("Michael Suyama")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "London"
h0 = .AddItem("Robert King")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "London"
h0 = .AddItem("Laura Callahan")
.DefaultItem = h0
.CellValue(0,1) = "Inside Sales Coordinator"
.DefaultItem = h0
.CellValue(0,2) = "Seattle"
h0 = .AddItem("Anne Dodsworth")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "London"
endwith
.EndUpdate
endwith
|
631
|
How can I list all items that contains any of specified words, not strings
![](images/exgridq631.png)
with thisform.Grid1
.BeginUpdate
.ColumnAutoResize = .T.
.ContinueColumnScroll = 0
.FocusColumnIndex = 1
.MarkSearchColumn = .F.
.SearchColumnIndex = 1
.FilterBarPromptVisible = 1
.FilterBarPromptType = 12802 && FilterPromptEnum.exFilterPromptWords Or FilterPromptEnum.exFilterPromptContainsAny
.FilterBarPromptPattern = "london nancy"
with .Columns
.Add("Name").Width = 96
.Add("Title").Width = 96
.Add("City")
endwith
with .Items
h0 = .AddItem("Nancy Davolio")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "Seattle"
h0 = .AddItem("Andrew Fuller")
.DefaultItem = h0
.CellValue(0,1) = "Vice President, Sales"
.DefaultItem = h0
.CellValue(0,2) = "Tacoma"
.DefaultItem = h0
.SelectItem(0) = .T.
h0 = .AddItem("Janet Leverling")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "Kirkland"
h0 = .AddItem("Margaret Peacock")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "Redmond"
h0 = .AddItem("Steven Buchanan")
.DefaultItem = h0
.CellValue(0,1) = "Sales Manager"
.DefaultItem = h0
.CellValue(0,2) = "London"
h0 = .AddItem("Michael Suyama")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "London"
h0 = .AddItem("Robert King")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "London"
h0 = .AddItem("Laura Callahan")
.DefaultItem = h0
.CellValue(0,1) = "Inside Sales Coordinator"
.DefaultItem = h0
.CellValue(0,2) = "Seattle"
h0 = .AddItem("Anne Dodsworth")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "London"
endwith
.EndUpdate
endwith
|
630
|
How can I list all items that contains all specified words, not strings
![](images/exgridq630.png)
with thisform.Grid1
.BeginUpdate
.ColumnAutoResize = .T.
.ContinueColumnScroll = 0
.FocusColumnIndex = 1
.MarkSearchColumn = .F.
.SearchColumnIndex = 1
.FilterBarPromptVisible = 1
.FilterBarPromptType = 12801 && FilterPromptEnum.exFilterPromptWords Or FilterPromptEnum.exFilterPromptContainsAll
.FilterBarPromptPattern = "london robert"
with .Columns
.Add("Name").Width = 96
.Add("Title").Width = 96
.Add("City")
endwith
with .Items
h0 = .AddItem("Nancy Davolio")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "Seattle"
h0 = .AddItem("Andrew Fuller")
.DefaultItem = h0
.CellValue(0,1) = "Vice President, Sales"
.DefaultItem = h0
.CellValue(0,2) = "Tacoma"
.DefaultItem = h0
.SelectItem(0) = .T.
h0 = .AddItem("Janet Leverling")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "Kirkland"
h0 = .AddItem("Margaret Peacock")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "Redmond"
h0 = .AddItem("Steven Buchanan")
.DefaultItem = h0
.CellValue(0,1) = "Sales Manager"
.DefaultItem = h0
.CellValue(0,2) = "London"
h0 = .AddItem("Michael Suyama")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "London"
h0 = .AddItem("Robert King")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "London"
h0 = .AddItem("Laura Callahan")
.DefaultItem = h0
.CellValue(0,1) = "Inside Sales Coordinator"
.DefaultItem = h0
.CellValue(0,2) = "Seattle"
h0 = .AddItem("Anne Dodsworth")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "London"
endwith
.EndUpdate
endwith
|
629
|
I've noticed that the filtering by prompt is not case sensitive, is is possible to make it case sensitive
![](images/exgridq629.png)
with thisform.Grid1
.BeginUpdate
.ColumnAutoResize = .T.
.ContinueColumnScroll = 0
.FocusColumnIndex = 1
.MarkSearchColumn = .F.
.SearchColumnIndex = 1
.FilterBarPromptVisible = 1
.FilterBarPromptType = 258 && FilterPromptEnum.exFilterPromptCaseSensitive Or FilterPromptEnum.exFilterPromptContainsAny
.FilterBarPromptPattern = "Anne"
with .Columns
.Add("Name").Width = 96
.Add("Title").Width = 96
.Add("City")
endwith
with .Items
h0 = .AddItem("Nancy Davolio")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "Seattle"
h0 = .AddItem("Andrew Fuller")
.DefaultItem = h0
.CellValue(0,1) = "Vice President, Sales"
.DefaultItem = h0
.CellValue(0,2) = "Tacoma"
.DefaultItem = h0
.SelectItem(0) = .T.
h0 = .AddItem("Janet Leverling")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "Kirkland"
h0 = .AddItem("Margaret Peacock")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "Redmond"
h0 = .AddItem("Steven Buchanan")
.DefaultItem = h0
.CellValue(0,1) = "Sales Manager"
.DefaultItem = h0
.CellValue(0,2) = "London"
h0 = .AddItem("Michael Suyama")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "London"
h0 = .AddItem("Robert King")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "London"
h0 = .AddItem("Laura Callahan")
.DefaultItem = h0
.CellValue(0,1) = "Inside Sales Coordinator"
.DefaultItem = h0
.CellValue(0,2) = "Seattle"
h0 = .AddItem("Anne Dodsworth")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "London"
endwith
.EndUpdate
endwith
|
628
|
Is it possible to list only items that ends with any of specified strings
![](images/exgridq628.png)
with thisform.Grid1
.BeginUpdate
.ColumnAutoResize = .T.
.ContinueColumnScroll = 0
.FocusColumnIndex = 1
.MarkSearchColumn = .F.
.SearchColumnIndex = 1
.FilterBarPromptVisible = 1
.FilterBarPromptType = 4
.FilterBarPromptColumns = "0"
.FilterBarPromptPattern = "Fuller"
with .Columns
.Add("Name").Width = 96
.Add("Title").Width = 96
.Add("City")
endwith
with .Items
h0 = .AddItem("Nancy Davolio")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "Seattle"
h0 = .AddItem("Andrew Fuller")
.DefaultItem = h0
.CellValue(0,1) = "Vice President, Sales"
.DefaultItem = h0
.CellValue(0,2) = "Tacoma"
.DefaultItem = h0
.SelectItem(0) = .T.
h0 = .AddItem("Janet Leverling")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "Kirkland"
h0 = .AddItem("Margaret Peacock")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "Redmond"
h0 = .AddItem("Steven Buchanan")
.DefaultItem = h0
.CellValue(0,1) = "Sales Manager"
.DefaultItem = h0
.CellValue(0,2) = "London"
h0 = .AddItem("Michael Suyama")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "London"
h0 = .AddItem("Robert King")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "London"
h0 = .AddItem("Laura Callahan")
.DefaultItem = h0
.CellValue(0,1) = "Inside Sales Coordinator"
.DefaultItem = h0
.CellValue(0,2) = "Seattle"
h0 = .AddItem("Anne Dodsworth")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "London"
endwith
.EndUpdate
endwith
|
627
|
Is it possible to list only items that ends with any of specified strings
![](images/exgridq627.png)
with thisform.Grid1
.BeginUpdate
.ColumnAutoResize = .T.
.ContinueColumnScroll = 0
.FocusColumnIndex = 1
.MarkSearchColumn = .F.
.SearchColumnIndex = 1
.FilterBarPromptVisible = 1
.FilterBarPromptType = 4
.FilterBarPromptColumns = "0"
.FilterBarPromptPattern = "Fuller"
with .Columns
.Add("Name").Width = 96
.Add("Title").Width = 96
.Add("City")
endwith
with .Items
h0 = .AddItem("Nancy Davolio")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "Seattle"
h0 = .AddItem("Andrew Fuller")
.DefaultItem = h0
.CellValue(0,1) = "Vice President, Sales"
.DefaultItem = h0
.CellValue(0,2) = "Tacoma"
.DefaultItem = h0
.SelectItem(0) = .T.
h0 = .AddItem("Janet Leverling")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "Kirkland"
h0 = .AddItem("Margaret Peacock")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "Redmond"
h0 = .AddItem("Steven Buchanan")
.DefaultItem = h0
.CellValue(0,1) = "Sales Manager"
.DefaultItem = h0
.CellValue(0,2) = "London"
h0 = .AddItem("Michael Suyama")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "London"
h0 = .AddItem("Robert King")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "London"
h0 = .AddItem("Laura Callahan")
.DefaultItem = h0
.CellValue(0,1) = "Inside Sales Coordinator"
.DefaultItem = h0
.CellValue(0,2) = "Seattle"
h0 = .AddItem("Anne Dodsworth")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "London"
endwith
.EndUpdate
endwith
|
626
|
Is it possible to list only items that starts with any of specified strings
![](images/exgridq626.png)
with thisform.Grid1
.BeginUpdate
.ColumnAutoResize = .T.
.ContinueColumnScroll = 0
.FocusColumnIndex = 1
.MarkSearchColumn = .F.
.SearchColumnIndex = 1
.FilterBarPromptVisible = 1
.FilterBarPromptType = 3
.FilterBarPromptColumns = "0"
.FilterBarPromptPattern = "An M"
with .Columns
.Add("Name").Width = 96
.Add("Title").Width = 96
.Add("City")
endwith
with .Items
h0 = .AddItem("Nancy Davolio")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "Seattle"
h0 = .AddItem("Andrew Fuller")
.DefaultItem = h0
.CellValue(0,1) = "Vice President, Sales"
.DefaultItem = h0
.CellValue(0,2) = "Tacoma"
.DefaultItem = h0
.SelectItem(0) = .T.
h0 = .AddItem("Janet Leverling")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "Kirkland"
h0 = .AddItem("Margaret Peacock")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "Redmond"
h0 = .AddItem("Steven Buchanan")
.DefaultItem = h0
.CellValue(0,1) = "Sales Manager"
.DefaultItem = h0
.CellValue(0,2) = "London"
h0 = .AddItem("Michael Suyama")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "London"
h0 = .AddItem("Robert King")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "London"
h0 = .AddItem("Laura Callahan")
.DefaultItem = h0
.CellValue(0,1) = "Inside Sales Coordinator"
.DefaultItem = h0
.CellValue(0,2) = "Seattle"
h0 = .AddItem("Anne Dodsworth")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "London"
endwith
.EndUpdate
endwith
|
625
|
Is it possible to list only items that starts with specified string
![](images/exgridq625.png)
with thisform.Grid1
.BeginUpdate
.ColumnAutoResize = .T.
.ContinueColumnScroll = 0
.FocusColumnIndex = 1
.MarkSearchColumn = .F.
.SearchColumnIndex = 1
.FilterBarPromptVisible = 1
.FilterBarPromptType = 3
.FilterBarPromptColumns = "0"
.FilterBarPromptPattern = "A"
with .Columns
.Add("Name").Width = 96
.Add("Title").Width = 96
.Add("City")
endwith
with .Items
h0 = .AddItem("Nancy Davolio")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "Seattle"
h0 = .AddItem("Andrew Fuller")
.DefaultItem = h0
.CellValue(0,1) = "Vice President, Sales"
.DefaultItem = h0
.CellValue(0,2) = "Tacoma"
.DefaultItem = h0
.SelectItem(0) = .T.
h0 = .AddItem("Janet Leverling")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "Kirkland"
h0 = .AddItem("Margaret Peacock")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "Redmond"
h0 = .AddItem("Steven Buchanan")
.DefaultItem = h0
.CellValue(0,1) = "Sales Manager"
.DefaultItem = h0
.CellValue(0,2) = "London"
h0 = .AddItem("Michael Suyama")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "London"
h0 = .AddItem("Robert King")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "London"
h0 = .AddItem("Laura Callahan")
.DefaultItem = h0
.CellValue(0,1) = "Inside Sales Coordinator"
.DefaultItem = h0
.CellValue(0,2) = "Seattle"
h0 = .AddItem("Anne Dodsworth")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "London"
endwith
.EndUpdate
endwith
|
624
|
How can I specify that the list should include any of the seqeunces in the pattern
![](images/exgridq624.png)
with thisform.Grid1
.BeginUpdate
.ColumnAutoResize = .T.
.ContinueColumnScroll = 0
.FocusColumnIndex = 1
.MarkSearchColumn = .F.
.SearchColumnIndex = 1
.FilterBarPromptVisible = 1
.FilterBarPromptType = 2
.FilterBarPromptPattern = "london seattle"
with .Columns
.Add("Name").Width = 96
.Add("Title").Width = 96
.Add("City")
endwith
with .Items
h0 = .AddItem("Nancy Davolio")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "Seattle"
h0 = .AddItem("Andrew Fuller")
.DefaultItem = h0
.CellValue(0,1) = "Vice President, Sales"
.DefaultItem = h0
.CellValue(0,2) = "Tacoma"
.DefaultItem = h0
.SelectItem(0) = .T.
h0 = .AddItem("Janet Leverling")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "Kirkland"
h0 = .AddItem("Margaret Peacock")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "Redmond"
h0 = .AddItem("Steven Buchanan")
.DefaultItem = h0
.CellValue(0,1) = "Sales Manager"
.DefaultItem = h0
.CellValue(0,2) = "London"
h0 = .AddItem("Michael Suyama")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "London"
h0 = .AddItem("Robert King")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "London"
h0 = .AddItem("Laura Callahan")
.DefaultItem = h0
.CellValue(0,1) = "Inside Sales Coordinator"
.DefaultItem = h0
.CellValue(0,2) = "Seattle"
h0 = .AddItem("Anne Dodsworth")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "London"
endwith
.EndUpdate
endwith
|
623
|
How can I specify that all sequences in the filter pattern must be included in the list
![](images/exgridq623.png)
with thisform.Grid1
.BeginUpdate
.ColumnAutoResize = .T.
.ContinueColumnScroll = 0
.FocusColumnIndex = 1
.MarkSearchColumn = .F.
.SearchColumnIndex = 1
.FilterBarPromptVisible = 1
.FilterBarPromptType = 1
.FilterBarPromptPattern = "london manager"
with .Columns
.Add("Name").Width = 96
.Add("Title").Width = 96
.Add("City")
endwith
with .Items
h0 = .AddItem("Nancy Davolio")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "Seattle"
h0 = .AddItem("Andrew Fuller")
.DefaultItem = h0
.CellValue(0,1) = "Vice President, Sales"
.DefaultItem = h0
.CellValue(0,2) = "Tacoma"
.DefaultItem = h0
.SelectItem(0) = .T.
h0 = .AddItem("Janet Leverling")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "Kirkland"
h0 = .AddItem("Margaret Peacock")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "Redmond"
h0 = .AddItem("Steven Buchanan")
.DefaultItem = h0
.CellValue(0,1) = "Sales Manager"
.DefaultItem = h0
.CellValue(0,2) = "London"
h0 = .AddItem("Michael Suyama")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "London"
h0 = .AddItem("Robert King")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "London"
h0 = .AddItem("Laura Callahan")
.DefaultItem = h0
.CellValue(0,1) = "Inside Sales Coordinator"
.DefaultItem = h0
.CellValue(0,2) = "Seattle"
h0 = .AddItem("Anne Dodsworth")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "London"
endwith
.EndUpdate
endwith
|
622
|
How do I change at runtime the filter prompt
![](images/exgridq622.png)
with thisform.Grid1
.BeginUpdate
.ColumnAutoResize = .T.
.ContinueColumnScroll = 0
.FocusColumnIndex = 1
.MarkSearchColumn = .F.
.SearchColumnIndex = 1
.FilterBarPromptVisible = 1
.FilterBarPromptPattern = "london manager"
with .Columns
.Add("Name").Width = 96
.Add("Title").Width = 96
.Add("City")
endwith
with .Items
h0 = .AddItem("Nancy Davolio")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "Seattle"
h0 = .AddItem("Andrew Fuller")
.DefaultItem = h0
.CellValue(0,1) = "Vice President, Sales"
.DefaultItem = h0
.CellValue(0,2) = "Tacoma"
.DefaultItem = h0
.SelectItem(0) = .T.
h0 = .AddItem("Janet Leverling")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "Kirkland"
h0 = .AddItem("Margaret Peacock")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "Redmond"
h0 = .AddItem("Steven Buchanan")
.DefaultItem = h0
.CellValue(0,1) = "Sales Manager"
.DefaultItem = h0
.CellValue(0,2) = "London"
h0 = .AddItem("Michael Suyama")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "London"
h0 = .AddItem("Robert King")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "London"
h0 = .AddItem("Laura Callahan")
.DefaultItem = h0
.CellValue(0,1) = "Inside Sales Coordinator"
.DefaultItem = h0
.CellValue(0,2) = "Seattle"
h0 = .AddItem("Anne Dodsworth")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "London"
endwith
.EndUpdate
endwith
|
621
|
How do I specify to filter only a single column when using the filter prompt
![](images/exgridq621.png)
with thisform.Grid1
.BeginUpdate
.ColumnAutoResize = .T.
.ContinueColumnScroll = 0
.FocusColumnIndex = 1
.MarkSearchColumn = .F.
.SearchColumnIndex = 1
.FilterBarPromptVisible = 1
.FilterBarPromptColumns = "2,3"
.FilterBarPromptPattern = "london"
with .Columns
.Add("Name").Width = 96
.Add("Title").Width = 96
.Add("City")
endwith
with .Items
h0 = .AddItem("Nancy Davolio")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "Seattle"
h0 = .AddItem("Andrew Fuller")
.DefaultItem = h0
.CellValue(0,1) = "Vice President, Sales"
.DefaultItem = h0
.CellValue(0,2) = "Tacoma"
.DefaultItem = h0
.SelectItem(0) = .T.
h0 = .AddItem("Janet Leverling")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "Kirkland"
h0 = .AddItem("Margaret Peacock")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "Redmond"
h0 = .AddItem("Steven Buchanan")
.DefaultItem = h0
.CellValue(0,1) = "Sales Manager"
.DefaultItem = h0
.CellValue(0,2) = "London"
h0 = .AddItem("Michael Suyama")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "London"
h0 = .AddItem("Robert King")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "London"
h0 = .AddItem("Laura Callahan")
.DefaultItem = h0
.CellValue(0,1) = "Inside Sales Coordinator"
.DefaultItem = h0
.CellValue(0,2) = "Seattle"
h0 = .AddItem("Anne Dodsworth")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "London"
endwith
.EndUpdate
endwith
|
620
|
How do I change the prompt or the caption being displayed in the filter bar
![](images/exgridq620.png)
with thisform.Grid1
.BeginUpdate
.ColumnAutoResize = .T.
.ContinueColumnScroll = 0
.FocusColumnIndex = 1
.MarkSearchColumn = .F.
.SearchColumnIndex = 1
.FilterBarPromptVisible = 1
.FilterBarPrompt = "changed"
with .Columns
.Add("Name").Width = 96
.Add("Title").Width = 96
.Add("City")
endwith
.EndUpdate
endwith
|
619
|
How do I enable the filter prompt feature
![](images/exgridq619.png)
with thisform.Grid1
.BeginUpdate
.ColumnAutoResize = .T.
.ContinueColumnScroll = 0
.FocusColumnIndex = 1
.MarkSearchColumn = .F.
.SearchColumnIndex = 1
.FilterBarPromptVisible = 1
with .Columns
.Add("Name").Width = 96
.Add("Title").Width = 96
.Add("City")
endwith
with .Items
h0 = .AddItem("Nancy Davolio")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "Seattle"
h0 = .AddItem("Andrew Fuller")
.DefaultItem = h0
.CellValue(0,1) = "Vice President, Sales"
.DefaultItem = h0
.CellValue(0,2) = "Tacoma"
.DefaultItem = h0
.SelectItem(0) = .T.
h0 = .AddItem("Janet Leverling")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "Kirkland"
h0 = .AddItem("Margaret Peacock")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "Redmond"
h0 = .AddItem("Steven Buchanan")
.DefaultItem = h0
.CellValue(0,1) = "Sales Manager"
.DefaultItem = h0
.CellValue(0,2) = "London"
h0 = .AddItem("Michael Suyama")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "London"
h0 = .AddItem("Robert King")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "London"
h0 = .AddItem("Laura Callahan")
.DefaultItem = h0
.CellValue(0,1) = "Inside Sales Coordinator"
.DefaultItem = h0
.CellValue(0,2) = "Seattle"
h0 = .AddItem("Anne Dodsworth")
.DefaultItem = h0
.CellValue(0,1) = "Sales Representative"
.DefaultItem = h0
.CellValue(0,2) = "London"
endwith
.EndUpdate
endwith
|
618
|
How can I control the colors that can be applied to an EBN part
![](images/exgridq618.png)
*** Change event - Occurs when the user changes the cell's content. ***
LPARAMETERS Item,ColIndex,NewValue
with thisform.Grid1
with .Items
.DefaultItem = .FirstVisibleItem
.ItemBackColor(0) = NewValue
endwith
endwith
with thisform.Grid1
.BeginUpdate
with .VisualAppearance
.Add(2,"c:\exontrol\images\normal.ebn")
.Add(1,"CP:2 10 3 -10 -5")
endwith
.SelBackColor = .BackColor
.SelForeColor = .ForeColor
.ScrollBySingleLine = .T.
.TreeColumnIndex = -1
with .Columns
with .Add("Test")
.Width = 32
endwith
with .Add("RGB")
with .Editor
.EditType = 20
.Option(44) = 255
.Option(41) = -60
endwith
endwith
endwith
with .Items
h = .AddItem("")
.DefaultItem = h
.CellHAlignment(0,0) = 1
.DefaultItem = h
.ItemDivider(0) = 0
.DefaultItem = h
.ItemBackColor(0) = 0x1000000
.DefaultItem = h
.ItemHeight(0) = 36
.DefaultItem = h
.SelectableItem(0) = .F.
h = .InsertItem(0,1,"Red")
.DefaultItem = h
.CellValue(0,1) = 255
h = .InsertItem(0,255,"Green")
.DefaultItem = h
.CellValue(0,1) = 255
h = .InsertItem(0,65536,"Blue")
.DefaultItem = h
.CellValue(0,1) = 255
endwith
.EndUpdate
endwith
|
617
|
I know this is fairly basic, but could you send me a sample that places a tree in the first column
![](images/exgridq617.png)
with thisform.Grid1
.BeginUpdate
.LinesAtRoot = -1
.Columns.Add("heading")
with .Items
h = .AddItem("Parent 1")
.InsertItem(h,Null,"Child A")
.InsertItem(.InsertItem(h,Null,"Child B"),Null,"GrandChild C")
.DefaultItem = h
.ExpandItem(0) = .T.
h = .AddItem("Parent 2")
.InsertItem(h,Null,"Child D")
.InsertItem(h,Null,"Child E")
.DefaultItem = h
.ExpandItem(0) = .T.
endwith
.EndUpdate
endwith
|
616
|
How can I get the caption of focused item
*** SelectionChanged event - Fired after a new item has been selected. ***
LPARAMETERS nop
with thisform.Grid1
with .Items
DEBUGOUT( "Handle" )
DEBUGOUT( .FocusItem )
DEBUGOUT( "Caption" )
DEBUGOUT( .CellCaption(.FocusItem,0) )
endwith
endwith
with thisform.Grid1
.BeginUpdate
.LinesAtRoot = -1
.Columns.Add("Items")
with .Items
h = .AddItem("R1")
.InsertItem(h,Null,"Cell 1.1")
.InsertItem(h,Null,"Cell 1.2")
.DefaultItem = h
.ExpandItem(0) = .T.
h = .AddItem("R2")
.InsertItem(h,Null,"Cell 2.1")
.InsertItem(h,Null,"Cell 2.2")
.DefaultItem = h
.ExpandItem(0) = .T.
endwith
.EndUpdate
endwith
|
615
|
How can I get the caption of selected item
*** SelectionChanged event - Fired after a new item has been selected. ***
LPARAMETERS nop
with thisform.Grid1
with .Items
DEBUGOUT( "Handle" )
DEBUGOUT( .SelectedItem(0) )
DEBUGOUT( "Caption" )
DEBUGOUT( .CellCaption(.SelectedItem(0),0) )
endwith
endwith
with thisform.Grid1
.BeginUpdate
.LinesAtRoot = -1
.Columns.Add("Items")
with .Items
h = .AddItem("R1")
.InsertItem(h,Null,"Cell 1.1")
.InsertItem(h,Null,"Cell 1.2")
.DefaultItem = h
.ExpandItem(0) = .T.
h = .AddItem("R2")
.InsertItem(h,Null,"Cell 2.1")
.InsertItem(h,Null,"Cell 2.2")
.DefaultItem = h
.ExpandItem(0) = .T.
endwith
.EndUpdate
endwith
|
614
|
Is it possible to let users selects cells as in Excel
![](images/exgridq614.png)
with thisform.Grid1
.BeginUpdate
.FullRowSelect = 1
.SingleSel = .F.
.ReadOnly = -1
.MarkSearchColumn = .F.
.ShowFocusRect = .F.
.LinesAtRoot = -1
.SelForeColor = RGB(0,0,0)
.SelBackColor = RGB(200,225,242)
with .Columns
.Add("A")
with .Add("B")
.AllowSizing = .F.
.Width = 24
endwith
with .Add("C")
.AllowSizing = .F.
.Width = 24
.Def(0) = 1
.PartialCheck = .T.
endwith
with .Add("D")
.AllowSizing = .F.
.Width = 24
.Def(1) = 1
endwith
endwith
with .Items
h = .InsertItem(Null,Null,"Group 1")
h1 = .InsertItem(h,Null,16)
.DefaultItem = h1
.CellValue(0,1) = 17
h1 = .InsertItem(h,Null,2)
.DefaultItem = h1
.CellValue(0,1) = 11
h1 = .InsertItem(h,Null,2)
.DefaultItem = h1
.ItemBackColor(0) = RGB(240,240,240)
.DefaultItem = h1
.CellValue(0,1) = 9
.DefaultItem = h
.ExpandItem(0) = .T.
h = .InsertItem(Null,Null,"Group 2")
.DefaultItem = h
.CellValueFormat(0,2) = 1
h1 = .InsertItem(h,Null,16)
.DefaultItem = h1
.CellValue(0,1) = 9
h1 = .InsertItem(h,Null,12)
.DefaultItem = h1
.CellValue(0,1) = 11
h1 = .InsertItem(h,Null,2)
.DefaultItem = h1
.CellValue(0,1) = 2
.DefaultItem = h
.ExpandItem(0) = .T.
.DefaultItem = h
.SelectItem(0) = .T.
endwith
.EndUpdate
endwith
|
613
|
Is it possible to change the style for the vertical or horizontal grid lines, in the list area
![](images/exgridq613.png)
with thisform.Grid1
.BeginUpdate
.DrawGridLines = -1
.GridLineStyle = 33 && GridLinesStyleEnum.exGridLinesVSolid Or GridLinesStyleEnum.exGridLinesHDot4
.Columns.Add("C1")
.Columns.Add("C2")
.Columns.Add("C3")
with .Items
h = .AddItem("Item 1")
.DefaultItem = h
.CellValue(0,1) = "SubItem 1.2"
.DefaultItem = h
.CellValue(0,2) = "SubItem 1.3"
h = .AddItem("Item 2")
.DefaultItem = h
.CellValue(0,1) = "SubItem 2.2"
.DefaultItem = h
.CellValue(0,2) = "SubItem 2.3"
endwith
.EndUpdate
endwith
|
612
|
Is it possible to change the style for the grid lines, for instance to be solid not dotted
![](images/exgridq612.png)
with thisform.Grid1
.BeginUpdate
.DrawGridLines = -1
.GridLineStyle = 48
.Columns.Add("Column")
.EndUpdate
endwith
|
611
|
I have some buttons added on the control's scroll bar, how can I can know when the button is being clicked
![](images/exgridq611.png)
*** ScrollButtonClick event - Occurs when the user clicks a button in the scrollbar. ***
LPARAMETERS ScrollBar,ScrollPart
with thisform.Grid1
DEBUGOUT( ScrollBar )
DEBUGOUT( ScrollPart )
endwith
with thisform.Grid1
.Object.ScrollPartVisible(1,32768) = .T.
.Object.ScrollPartVisible(1,16384) = .T.
.Object.ScrollPartVisible(1,1) = .T.
.Object.ScrollPartVisible(1,2) = .T.
.ScrollBars = 5
endwith
|
610
|
How do I get notified once the user clicks a hyperlink created using the anchor HTML tag
![](images/exgridq610.png)
*** AnchorClick event - Occurs when an anchor element is clicked. ***
LPARAMETERS AnchorID,Options
with thisform.Grid1
DEBUGOUT( AnchorID )
DEBUGOUT( Options )
endwith
with thisform.Grid1
.Columns.Add("Default").Def(17) = 1
with .Items
.AddItem("This is a link: <aex.com;1>www.exontrol.com</a>")
.AddItem("This is a link: <aex.net;2>www.exontrol.net</a>")
endwith
endwith
|
609
|
Is it possible to start editing a cell when double click it
![](images/exgridq609.png)
*** DblClick event - Occurs when the user dblclk the left mouse button over an object. ***
LPARAMETERS Shift,X,Y
with thisform.Grid1
.Edit()
endwith
with thisform.Grid1
.BeginUpdate
.AutoEdit = .F.
.MarkSearchColumn = .F.
.Columns.Add("Edit1").Editor.EditType = 1
.Columns.Add("Edit2").Editor.EditType = 1
with .Items
.DefaultItem = .AddItem(1)
.CellValue(0,1) = 2
endwith
with .Items
.DefaultItem = .AddItem(3)
.CellValue(0,1) = 4
endwith
.EndUpdate
endwith
|
608
|
Is it possible to disable standard single-click behavior for this column, so I manually could call Edit() when needed
![](images/exgridq608.png)
*** DblClick event - Occurs when the user dblclk the left mouse button over an object. ***
LPARAMETERS Shift,X,Y
with thisform.Grid1
.Edit()
endwith
with thisform.Grid1
.BeginUpdate
.AutoEdit = .F.
.MarkSearchColumn = .F.
.Columns.Add("Edit1").Editor.EditType = 1
.Columns.Add("Edit2").Editor.EditType = 1
with .Items
.DefaultItem = .AddItem(1)
.CellValue(0,1) = 2
endwith
with .Items
.DefaultItem = .AddItem(3)
.CellValue(0,1) = 4
endwith
.EndUpdate
endwith
|
607
|
How can I get or restore the old or previously value for the cell being changed
*** Change event - Occurs when the user changes the cell's content. ***
LPARAMETERS Item,ColIndex,NewValue
with thisform.Grid1
DEBUGOUT( "Old-Value:" )
DEBUGOUT( .Items.CellValue(Item,ColIndex) )
DEBUGOUT( "New-Value:" )
DEBUGOUT( NewValue )
endwith
with thisform.Grid1
.BeginUpdate
.MarkSearchColumn = .F.
.Columns.Add("Edit1").Editor.EditType = 1
.Columns.Add("Edit2").Editor.EditType = 1
with .Items
.DefaultItem = .AddItem(1)
.CellValue(0,1) = 2
endwith
with .Items
.DefaultItem = .AddItem(3)
.CellValue(0,1) = 4
endwith
.EndUpdate
endwith
|
606
|
How can I get the item from the cursor
*** MouseMove event - Occurs when the user moves the mouse. ***
LPARAMETERS Button,Shift,X,Y
with thisform.Grid1
h = .ItemFromPoint(-1,-1,c,hit)
DEBUGOUT( "Handle" )
DEBUGOUT( h )
DEBUGOUT( "Index" )
DEBUGOUT( .Items.ItemToIndex(h) )
endwith
with thisform.Grid1
.BeginUpdate
.LinesAtRoot = -1
.DrawGridLines = 1
.Columns.Add("Items")
with .Items
h = .AddItem("R1")
.InsertItem(h,Null,"Cell 1.1")
.InsertItem(h,Null,"Cell 1.2")
.DefaultItem = h
.ExpandItem(0) = .T.
h = .AddItem("R2")
.InsertItem(h,Null,"Cell 2.1")
.InsertItem(h,Null,"Cell 2.2")
.DefaultItem = h
.ExpandItem(0) = .T.
endwith
.EndUpdate
endwith
|
605
|
How can I get the column from the cursor, not only in the header
![](images/exgridq605.png)
*** MouseMove event - Occurs when the user moves the mouse. ***
LPARAMETERS Button,Shift,X,Y
with thisform.Grid1
DEBUGOUT( .ColumnFromPoint(-1,0) )
endwith
with thisform.Grid1
.BeginUpdate
.LinesAtRoot = -1
.Columns.Add("P1")
.Columns.Add("P2")
.DrawGridLines = -1
with .Items
h = .AddItem("R1")
.DefaultItem = h
.CellValue(0,1) = "R2"
.DefaultItem = .InsertItem(h,Null,"Cell 1.1")
.CellValue(0,1) = "Cell 1.2"
.DefaultItem = .InsertItem(h,Null,"Cell 2.1")
.CellValue(0,1) = "Cell 2.2"
.DefaultItem = h
.ExpandItem(0) = .T.
endwith
.EndUpdate
endwith
|
604
|
How can I get the column from the cursor
![](images/exgridq604.png)
*** MouseMove event - Occurs when the user moves the mouse. ***
LPARAMETERS Button,Shift,X,Y
with thisform.Grid1
DEBUGOUT( .ColumnFromPoint(-1,-1) )
endwith
with thisform.Grid1
.BeginUpdate
.LinesAtRoot = -1
.DrawGridLines = -1
.Columns.Add("P1")
.Columns.Add("P2")
with .Items
h = .AddItem("R1")
.DefaultItem = h
.CellValue(0,1) = "R2"
.DefaultItem = .InsertItem(h,Null,"Cell 1.1")
.CellValue(0,1) = "Cell 1.2"
.DefaultItem = .InsertItem(h,Null,"Cell 2.1")
.CellValue(0,1) = "Cell 2.2"
.DefaultItem = h
.ExpandItem(0) = .T.
endwith
.EndUpdate
endwith
|
603
|
How can I get the cell's caption from the cursor
*** MouseMove event - Occurs when the user moves the mouse. ***
LPARAMETERS Button,Shift,X,Y
with thisform.Grid1
h = .ItemFromPoint(-1,-1,c,hit)
DEBUGOUT( .Items.CellCaption(h,c) )
endwith
with thisform.Grid1
.BeginUpdate
.LinesAtRoot = -1
.Columns.Add("Items")
with .Items
h = .AddItem("R1")
.InsertItem(h,Null,"Cell 1.1")
.InsertItem(h,Null,"Cell 1.2")
.DefaultItem = h
.ExpandItem(0) = .T.
h = .AddItem("R2")
.InsertItem(h,Null,"Cell 2.1")
.InsertItem(h,Null,"Cell 2.2")
.DefaultItem = h
.ExpandItem(0) = .T.
endwith
.EndUpdate
endwith
|
602
|
How can I customize the items based on the values in the cells
![](images/exgridq602.png)
with thisform.Grid1
.BeginUpdate
.MarkSearchColumn = .F.
with .ConditionalFormats
with .Add("%1 >4")
.Bold = .T.
.StrikeOut = .T.
.ForeColor = RGB(255,0,0)
.ApplyTo = -1
endwith
with .Add("%2 > 4")
.Bold = .T.
.StrikeOut = .T.
.ForeColor = RGB(255,0,0)
.ApplyTo = 2 && 0x2
endwith
with .Add("%3 > 4")
.Bold = .T.
.StrikeOut = .T.
.ForeColor = RGB(255,0,0)
.ApplyTo = 3 && 0x3
endwith
endwith
with .Columns
.Add("Name")
with .Add("A")
.SortType = 1
.AllowSizing = .F.
.Width = 36
.FormatColumn = "len(value) ? value + ' +'"
.Editor.EditType = 4
endwith
with .Add("B")
.SortType = 1
.AllowSizing = .F.
.Width = 36
.FormatColumn = "len(value) ? value + ' +'"
.Editor.EditType = 4
endwith
with .Add("C")
.SortType = 1
.AllowSizing = .F.
.Width = 36
.FormatColumn = "len(value) ? value + ' ='"
.Editor.EditType = 4
endwith
with .Add("A+B+C")
.SortType = 1
.AllowSizing = .F.
.Width = 64
.ComputedField = "%1+%2+%3"
.FormatColumn = "((0:=dbl(value)) < 10? '<fgcolor=808080><font ;7>' :'<b>') + currency(=:0)"
.Def(17) = 1
endwith
endwith
with .Items
h = .AddItem("Root")
.DefaultItem = h
.CellValueFormat(0,4) = 2
h1 = .InsertItem(h,Null,"Child 1")
.DefaultItem = h1
.CellValue(0,1) = 7
.DefaultItem = h1
.CellValue(0,2) = 3
.DefaultItem = h1
.CellValue(0,3) = 1
h1 = .InsertItem(h,Null,"Child 2")
.DefaultItem = h1
.CellValue(0,1) = 2
.DefaultItem = h1
.CellValue(0,2) = 5
.DefaultItem = h1
.CellValue(0,3) = 12
h1 = .InsertItem(h,Null,"Child 3")
.DefaultItem = h1
.CellValue(0,1) = 2
.DefaultItem = h1
.CellValue(0,2) = 2
.DefaultItem = h1
.CellValue(0,3) = 4
h1 = .InsertItem(h,Null,"Child 4")
.DefaultItem = h1
.CellValue(0,1) = 2
.DefaultItem = h1
.CellValue(0,2) = 9
.DefaultItem = h1
.CellValue(0,3) = 4
.DefaultItem = h
.ExpandItem(0) = .T.
endwith
.EndUpdate
endwith
|
601
|
Is it is possible to have a column computing values from other columns
![](images/exgridq601.png)
with thisform.Grid1
.BeginUpdate
.MarkSearchColumn = .F.
with .Columns
.Add("Name")
with .Add("A")
.SortType = 1
.AllowSizing = .F.
.Width = 36
.FormatColumn = "len(value) ? value + ' +'"
.Editor.EditType = 4
endwith
with .Add("B")
.SortType = 1
.AllowSizing = .F.
.Width = 36
.FormatColumn = "len(value) ? value + ' +'"
.Editor.EditType = 4
endwith
with .Add("C")
.SortType = 1
.AllowSizing = .F.
.Width = 36
.FormatColumn = "len(value) ? value + ' ='"
.Editor.EditType = 4
endwith
with .Add("A+B+C")
.SortType = 1
.AllowSizing = .F.
.Width = 64
.ComputedField = "%1+%2+%3"
.FormatColumn = "((0:=dbl(value)) < 10? '<fgcolor=808080><font ;7>' :'<b>') + currency(=:0)"
.Def(17) = 1
endwith
endwith
with .Items
h = .AddItem("Root")
.DefaultItem = h
.CellValueFormat(0,4) = 2
h1 = .InsertItem(h,Null,"Child 1")
.DefaultItem = h1
.CellValue(0,1) = 7
.DefaultItem = h1
.CellValue(0,2) = 3
.DefaultItem = h1
.CellValue(0,3) = 1
h1 = .InsertItem(h,Null,"Child 2")
.DefaultItem = h1
.CellValue(0,1) = 2
.DefaultItem = h1
.CellValue(0,2) = 5
.DefaultItem = h1
.CellValue(0,3) = 12
h1 = .InsertItem(h,Null,"Child 3")
.DefaultItem = h1
.CellValue(0,1) = 2
.DefaultItem = h1
.CellValue(0,2) = 2
.DefaultItem = h1
.CellValue(0,3) = 4
h1 = .InsertItem(h,Null,"Child 4")
.DefaultItem = h1
.CellValue(0,1) = 2
.DefaultItem = h1
.CellValue(0,2) = 9
.DefaultItem = h1
.CellValue(0,3) = 4
.DefaultItem = h
.ExpandItem(0) = .T.
endwith
.EndUpdate
endwith
|